changeset 74a5b0f1c32e in modules/account_stock_landed_cost:default
details:
https://hg.tryton.org/modules/account_stock_landed_cost?cmd=changeset;node=74a5b0f1c32e
description:
Store directly sequence type to sequence
issue10122
review351381002
diffstat:
account.py | 13 +++++++------
account.xml | 3 +--
2 files changed, 8 insertions(+), 8 deletions(-)
diffs (70 lines):
diff -r e2ff1546fba6 -r 74a5b0f1c32e account.py
--- a/account.py Sat Feb 27 18:16:28 2021 +0100
+++ b/account.py Thu Mar 11 23:00:10 2021 +0100
@@ -6,7 +6,7 @@
from trytond.i18n import gettext
from trytond.model import ModelSQL, ModelView, Workflow, MatchMixin, fields
from trytond.pool import Pool, PoolMeta
-from trytond.pyson import Eval
+from trytond.pyson import Eval, Id
from trytond.transaction import Transaction
from trytond import backend
from trytond.tools.multivalue import migrate_property
@@ -30,7 +30,9 @@
domain=[
('company', 'in',
[Eval('context', {}).get('company', -1), None]),
- ('code', '=', 'account.landed_cost'),
+ ('sequence_type', '=',
+ Id('account_stock_landed_cost',
+ 'sequence_type_landed_cost')),
]))
@classmethod
@@ -46,7 +48,8 @@
'ir.sequence', "Landed Cost Sequence", required=True,
domain=[
('company', 'in', [Eval('company', -1), None]),
- ('code', '=', 'account.landed_cost'),
+ ('sequence_type', '=',
+ Id('account_stock_landed_cost', 'sequence_type_landed_cost')),
],
depends=['company'])
@@ -399,15 +402,13 @@
@classmethod
def create(cls, vlist):
pool = Pool()
- Sequence = pool.get('ir.sequence')
Config = pool.get('account.configuration')
vlist = [v.copy() for v in vlist]
config = Config(1)
for values in vlist:
if values.get('number') is None:
- values['number'] = Sequence.get_id(
- config.landed_cost_sequence.id)
+ values['number'] = config.landed_cost_sequence.get()
return super(LandedCost, cls).create(vlist)
diff -r e2ff1546fba6 -r 74a5b0f1c32e account.xml
--- a/account.xml Sat Feb 27 18:16:28 2021 +0100
+++ b/account.xml Thu Mar 11 23:00:10 2021 +0100
@@ -5,7 +5,6 @@
<data>
<record model="ir.sequence.type" id="sequence_type_landed_cost">
<field name="name">Landed Cost</field>
- <field name="code">account.landed_cost</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_landed_code_group_admin">
@@ -20,7 +19,7 @@
<record model="ir.sequence" id="sequence_landed_cost">
<field name="name">Landed Cost</field>
- <field name="code">account.landed_cost</field>
+ <field name="sequence_type" ref="sequence_type_landed_cost"/>
</record>
<record model="ir.ui.view" id="configuration_view_form">