Store directly sequence type to sequence
issue10122 review351381002
This commit is contained in:
1 parent
7c323c340c
commit
96aaa95a41
2 files changed
+7
-7
No files matched your search
@@ -4,7 +4,7 @@ from trytond import backend
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import ModelSQL, ModelView, Workflow, fields, tree
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, Id
|
||||
from trytond.report import Report
|
||||
|
||||
from .exceptions import PackageError
|
||||
@@ -16,7 +16,8 @@ class Configuration(metaclass=PoolMeta):
|
||||
'ir.sequence', "Package Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('context', {}).get('company'), None]),
|
||||
('code', '=', 'stock.package'),
|
||||
('sequence_type', '=',
|
||||
Id('stock_package', 'sequence_type_package')),
|
||||
]))
|
||||
|
||||
@classmethod
|
||||
@@ -38,7 +39,8 @@ class ConfigurationSequence(metaclass=PoolMeta):
|
||||
'ir.sequence', "Package Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('code', '=', 'stock.package'),
|
||||
('sequence_type', '=',
|
||||
Id('stock_package', 'sequence_type_package')),
|
||||
],
|
||||
depends=['company'])
|
||||
|
||||
@@ -150,13 +152,12 @@ class Package(tree(), ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
pool = Pool()
|
||||
Sequence = pool.get('ir.sequence')
|
||||
Config = pool.get('stock.configuration')
|
||||
|
||||
vlist = [v.copy() for v in vlist]
|
||||
config = Config(1)
|
||||
for values in vlist:
|
||||
values['code'] = Sequence.get_id(config.package_sequence)
|
||||
values['code'] = config.package_sequence.get()
|
||||
return super(Package, cls).create(vlist)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -5,7 +5,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<record model="ir.sequence.type" id="sequence_type_package">
|
||||
<field name="name">Stock Package</field>
|
||||
<field name="code">stock.package</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_package_group_admin">
|
||||
@@ -20,7 +19,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence" id="sequence_package">
|
||||
<field name="name">Stock Package</field>
|
||||
<field name="code">stock.package</field>
|
||||
<field name="sequence_type" ref="sequence_type_package"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="stock_configuration_view_form">
|
||||
|
||||
Reference in new issue
Block a user