changeset 7c7e3e482ea0 in modules/party:4.4
details: https://hg.tryton.org/modules/party?cmd=changeset;node=7c7e3e482ea0
description:
        Set default party sequence on configuration

        This ensure when there is no configuration record, the value displayed 
is
        actually the value used.

        issue8241
        review275171002
        (grafted from 8f7d2a94b2cb08f6c375444b191ac2e4aa5fb1a6)
diffstat:

 configuration.py |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 0fabec45a7cd -r 7c7e3e482ea0 configuration.py
--- a/configuration.py  Tue Feb 19 23:13:09 2019 +0100
+++ b/configuration.py  Thu Apr 04 19:11:44 2019 +0200
@@ -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 @@
     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):
 

Reply via email to