From 0b7d5026432608c910dfd2878ec40b9e9d6d9f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Apr 2019 19:11:44 +0200 Subject: [PATCH] Set default party sequence on configuration This ensure when there is no configuration record, the value displayed is actually the value used. issue8241 review275171002 --- configuration.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configuration.py b/configuration.py index 61552b5292..e16f975e6c 100644 --- a/configuration.py +++ b/configuration.py @@ -1,8 +1,9 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. +from trytond import backend from trytond.model import ModelView, ModelSQL, ModelSingleton, fields from trytond.model import MultiValueMixin, ValueMixin -from trytond import backend +from trytond.pool import Pool from trytond.tools.multivalue import migrate_property __all__ = ['Configuration', 'ConfigurationSequence', 'ConfigurationLang'] @@ -23,6 +24,15 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, MultiValueMixin): party_sequence = fields.MultiValue(party_sequence) party_lang = fields.MultiValue(party_lang) + @classmethod + def default_party_sequence(cls): + pool = Pool() + ModelData = pool.get('ir.model.data') + try: + return ModelData.get_id('party', 'sequence_party') + except KeyError: + return None + class _ConfigurationValue(ModelSQL):