Store directly sequence type to sequence
This commit is contained in:
parent
7e5bd801db
commit
b65280218c
|
@ -1,7 +1,7 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from trytond.model import fields, ModelSQL
|
from trytond.model import fields, ModelSQL
|
||||||
from trytond.pyson import Eval
|
from trytond.pyson import Eval, Id
|
||||||
from trytond.pool import PoolMeta, Pool
|
from trytond.pool import PoolMeta, Pool
|
||||||
from trytond.modules.company.model import (
|
from trytond.modules.company.model import (
|
||||||
CompanyMultiValueMixin, CompanyValueMixin)
|
CompanyMultiValueMixin, CompanyValueMixin)
|
||||||
|
@ -17,7 +17,8 @@ class Configuration(CompanyMultiValueMixin, metaclass=PoolMeta):
|
||||||
'Product Cost Plan Sequence', domain=[
|
'Product Cost Plan Sequence', domain=[
|
||||||
('company', 'in',
|
('company', 'in',
|
||||||
[Eval('context', {}).get('company', -1), None]),
|
[Eval('context', {}).get('company', -1), None]),
|
||||||
('code', '=', 'product_cost_plan'),
|
('sequence_type', '=', Id('product_cost_plan',
|
||||||
|
'sequence_type_product_cost_plan')),
|
||||||
], required=True))
|
], required=True))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -36,5 +37,6 @@ class ConfigurationProductcostPlan(ModelSQL, CompanyValueMixin):
|
||||||
'Product Cost Plan Sequence', domain=[
|
'Product Cost Plan Sequence', domain=[
|
||||||
('company', 'in',
|
('company', 'in',
|
||||||
[Eval('context', {}).get('company', -1), None]),
|
[Eval('context', {}).get('company', -1), None]),
|
||||||
('code', '=', 'product_cost_plan'),
|
('sequence_type', '=', Id('product_cost_plan',
|
||||||
|
'sequence_type_product_cost_plan')),
|
||||||
], required=True)
|
], required=True)
|
||||||
|
|
5
plan.py
5
plan.py
|
@ -446,15 +446,12 @@ class Plan(ModelSQL, ModelView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, vlist):
|
def create(cls, vlist):
|
||||||
Sequence = Pool().get('ir.sequence')
|
|
||||||
Config = Pool().get('production.configuration')
|
Config = Pool().get('production.configuration')
|
||||||
|
|
||||||
vlist = [x.copy() for x in vlist]
|
vlist = [x.copy() for x in vlist]
|
||||||
config = Config(1)
|
config = Config(1)
|
||||||
for values in vlist:
|
for values in vlist:
|
||||||
values['number'] = Sequence.get_id(
|
values['number'] = config.product_cost_plan_sequence.get()
|
||||||
config.product_cost_plan_sequence and
|
|
||||||
config.product_cost_plan_sequence.id)
|
|
||||||
return super(Plan, cls).create(vlist)
|
return super(Plan, cls).create(vlist)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
3
plan.xml
3
plan.xml
|
@ -19,7 +19,6 @@
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.sequence.type" id="sequence_type_product_cost_plan">
|
<record model="ir.sequence.type" id="sequence_type_product_cost_plan">
|
||||||
<field name="name">Product Cost Plan</field>
|
<field name="name">Product Cost Plan</field>
|
||||||
<field name="code">product_cost_plan</field>
|
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.sequence.type-res.group"
|
<record model="ir.sequence.type-res.group"
|
||||||
id="sequence_type_product_cost_plan_group_admin">
|
id="sequence_type_product_cost_plan_group_admin">
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
|
|
||||||
<record model="ir.sequence" id="sequence_product_cost_plan">
|
<record model="ir.sequence" id="sequence_product_cost_plan">
|
||||||
<field name="name">Product Cost Plan</field>
|
<field name="name">Product Cost Plan</field>
|
||||||
<field name="code">product_cost_plan</field>
|
<field name="sequence_type" ref="sequence_type_product_cost_plan"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- product.cost.plan -->
|
<!-- product.cost.plan -->
|
||||||
|
|
Loading…
Reference in New Issue