From 2a1be05a1fbbd89d6e2fbdddc5f9625bedfb95df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 11 Mar 2021 23:00:09 +0100 Subject: [PATCH] Store directly sequence type to sequence issue10122 review351381002 --- account.py | 9 ++++++--- payment.py | 5 +---- payment.xml | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/account.py b/account.py index ba65997681..81e40eb539 100644 --- a/account.py +++ b/account.py @@ -12,7 +12,7 @@ from trytond import backend from trytond.i18n import gettext from trytond.pool import Pool, PoolMeta from trytond.model import ModelSQL, ModelView, fields -from trytond.pyson import Eval, If, Bool +from trytond.pyson import Eval, If, Bool, Id from trytond.wizard import (Wizard, StateView, StateAction, StateTransition, Button) from trytond.transaction import Transaction @@ -384,7 +384,9 @@ class Configuration(metaclass=PoolMeta): domain=[ ('company', 'in', [Eval('context', {}).get('company', -1), None]), - ('code', '=', 'account.payment.group'), + ('sequence_type', '=', + Id('account_payment', + 'sequence_type_account_payment_group')), ])) @classmethod @@ -400,7 +402,8 @@ class ConfigurationPaymentGroupSequence(ModelSQL, CompanyValueMixin): 'ir.sequence', "Payment Group Sequence", required=True, domain=[ ('company', 'in', [Eval('company', -1), None]), - ('code', '=', 'account.payment.group'), + ('sequence_type', '=', + Id('account_payment', 'sequence_type_account_payment_group')), ], depends=['company']) diff --git a/payment.py b/payment.py index e3ef32b3d1..3aadf7c29d 100644 --- a/payment.py +++ b/payment.py @@ -111,16 +111,13 @@ class Group(ModelSQL, ModelView): @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.payment_group_sequence.id) - + values['number'] = config.payment_group_sequence.get() return super(Group, cls).create(vlist) @classmethod diff --git a/payment.xml b/payment.xml index e9680b5dd4..afd63482c6 100644 --- a/payment.xml +++ b/payment.xml @@ -174,7 +174,6 @@ this repository contains the full copyright notices and license terms. --> Account Payment Group - account.payment.group @@ -191,7 +190,7 @@ this repository contains the full copyright notices and license terms. --> Default Account Payment Group - account.payment.group +