From b8f4bee761f9cd1063d050d17df6030cf1da7aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 11 Mar 2021 23:00:10 +0100 Subject: [PATCH] Store directly sequence type to sequence issue10122 review351381002 --- configuration.py | 3 ++- party.py | 3 +-- party.xml | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/configuration.py b/configuration.py index 57834d8584..2b54f4acf6 100644 --- a/configuration.py +++ b/configuration.py @@ -5,10 +5,11 @@ from trytond.model import ModelView, ModelSQL, ModelSingleton, fields from trytond.model import MultiValueMixin, ValueMixin from trytond.pool import Pool from trytond.tools.multivalue import migrate_property +from trytond.pyson import Id party_sequence = fields.Many2One('ir.sequence', 'Party Sequence', domain=[ - ('code', '=', 'party.party'), + ('sequence_type', '=', Id('party', 'sequence_type_party')), ], help="Used to generate the party code.") party_lang = fields.Many2One("ir.lang", 'Party Language', diff --git a/party.py b/party.py index c4cc40afe4..c05e8b71af 100644 --- a/party.py +++ b/party.py @@ -172,12 +172,11 @@ class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin): @classmethod def _new_code(cls, **pattern): pool = Pool() - Sequence = pool.get('ir.sequence') Configuration = pool.get('party.configuration') config = Configuration(1) sequence = config.get_multivalue('party_sequence', **pattern) if sequence: - return Sequence.get_id(sequence.id) + return sequence.get() @classmethod def create(cls, vlist): diff --git a/party.xml b/party.xml index 585a6e74d3..0541342bfe 100644 --- a/party.xml +++ b/party.xml @@ -92,7 +92,6 @@ this repository contains the full copyright notices and license terms. --> Party - party.party @@ -107,7 +106,7 @@ this repository contains the full copyright notices and license terms. --> Party - party.party +