Store directly sequence type to sequence
issue10122 review351381002
This commit is contained in:
1 parent
dce76127ff
commit
3ab2db2802
3 files changed
+7
-8
No files matched your search
+5
-3
@@ -3,7 +3,7 @@
|
||||
from trytond import backend
|
||||
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, Id
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
@@ -19,7 +19,8 @@ class Configuration(
|
||||
domain=[
|
||||
('company', 'in',
|
||||
[Eval('context', {}).get('company', -1), None]),
|
||||
('code', '=', 'production'),
|
||||
('sequence_type', '=',
|
||||
Id('production', 'sequence_type_production')),
|
||||
]))
|
||||
|
||||
@classmethod
|
||||
@@ -35,7 +36,8 @@ class ConfigurationProductionSequence(ModelSQL, CompanyValueMixin):
|
||||
'ir.sequence', "Production Sequence", required=True,
|
||||
domain=[
|
||||
('company', 'in', [Eval('company', -1), None]),
|
||||
('code', '=', 'production'),
|
||||
('sequence_type', '=',
|
||||
Id('production', 'sequence_type_production')),
|
||||
],
|
||||
depends=['company'])
|
||||
|
||||
|
||||
+1
-3
@@ -623,15 +623,13 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
Sequence = Pool().get('ir.sequence')
|
||||
Config = Pool().get('production.configuration')
|
||||
|
||||
vlist = [x.copy() for x in vlist]
|
||||
config = Config(1)
|
||||
for values in vlist:
|
||||
if values.get('number') is None:
|
||||
values['number'] = Sequence.get_id(
|
||||
config.production_sequence.id)
|
||||
values['number'] = config.production_sequence.get()
|
||||
productions = super(Production, cls).create(vlist)
|
||||
for production in productions:
|
||||
production._set_move_planned_date()
|
||||
|
||||
+1
-2
@@ -163,7 +163,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence.type" id="sequence_type_production">
|
||||
<field name="name">Production</field>
|
||||
<field name="code">production</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_production_group_admin">
|
||||
@@ -178,7 +177,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.sequence" id="sequence_production">
|
||||
<field name="name">Production</field>
|
||||
<field name="code">production</field>
|
||||
<field name="sequence_type" ref="sequence_type_production"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.access" id="access_production">
|
||||
|
||||
Reference in new issue
Block a user