"Sequence and tree editable migration to 6.0 [SKIP CI]."
This commit is contained in:
parent
9b22dd5a94
commit
fc2284ce22
36
stock.py
36
stock.py
|
@ -10,7 +10,7 @@ from sql.operators import Concat
|
|||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.model import Workflow
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.pyson import Eval, If, Id
|
||||
from trytond.tools import grouped_slice
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import Wizard, StateTransition, StateView, Button
|
||||
|
@ -26,10 +26,12 @@ class Configuration(metaclass=PoolMeta):
|
|||
|
||||
reconcile_sequence = fields.MultiValue(
|
||||
fields.Many2One('ir.sequence', 'Shipment reconcile Sequence',
|
||||
domain=[('company', 'in',
|
||||
[Eval('context', {}).get('company', -1), None]),
|
||||
('code', '=', 'stock.shipment.reconciliation')],
|
||||
required=True)
|
||||
domain=[
|
||||
('company', 'in',
|
||||
[Eval('context', {}).get('company', -1), None]),
|
||||
('sequence_type', '=', Id('stock_shipment_reconcile',
|
||||
'sequence_type_reconcile'))
|
||||
], required=True)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@ -50,11 +52,14 @@ class ConfigurationSequence(metaclass=PoolMeta):
|
|||
|
||||
reconcile_sequence = fields.Many2One('ir.sequence',
|
||||
'Shipment reconcile Sequence',
|
||||
domain=[('company', 'in',
|
||||
[Eval('company', -1), None]),
|
||||
('code', '=', 'stock.shipment.reconciliation')],
|
||||
depends=['company'],
|
||||
required=True)
|
||||
domain=[
|
||||
('company', 'in',
|
||||
[Eval('company', -1), None]),
|
||||
('sequence_type', '=', Id('stock_shipment_reconcile',
|
||||
'sequence_type_reconcile'))
|
||||
],
|
||||
depends=['company'],
|
||||
required=True)
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
|
@ -201,15 +206,16 @@ class ShipmentReconciliation(Workflow, ModelSQL, ModelView):
|
|||
@classmethod
|
||||
def create(cls, vlist):
|
||||
pool = Pool()
|
||||
model_sequence = pool.get('ir.sequence')
|
||||
model_config = pool.get('stock.configuration')
|
||||
Config = pool.get('stock.configuration')
|
||||
|
||||
vlist = [x.copy() for x in vlist]
|
||||
config = model_config(1)
|
||||
config = Config(1)
|
||||
default_company = cls.default_company()
|
||||
for values in vlist:
|
||||
if not values.get('code'):
|
||||
values['code'] = model_sequence.get_id(
|
||||
config.reconcile_sequence.id)
|
||||
values['code'] = config.get_multivalue(
|
||||
'reconcile_sequence',
|
||||
company=values.get('company', default_company)).get()
|
||||
return super(ShipmentReconciliation, cls).create(vlist)
|
||||
|
||||
def _get_shipment_type(self):
|
||||
|
|
|
@ -23,7 +23,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<!-- Sequence reconcile -->
|
||||
<record model="ir.sequence.type" id="sequence_type_reconcile">
|
||||
<field name="name">Shipment reconcile</field>
|
||||
<field name="code">stock.shipment.reconciliation</field>
|
||||
</record>
|
||||
<record model="ir.sequence.type-res.group"
|
||||
id="sequence_type_reconcile_group_admin">
|
||||
|
@ -37,7 +36,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
</record>
|
||||
<record model="ir.sequence" id="sequence_reconcile">
|
||||
<field name="name">Shipment reconcile</field>
|
||||
<field name="code">stock.shipment.reconciliation</field>
|
||||
<field name="sequence_type" ref="sequence_type_reconcile"/>
|
||||
</record>
|
||||
|
||||
<!-- Reconciliation -->
|
||||
|
|
Loading…
Reference in New Issue