changeset de7becf24ee0 in modules/party:5.0
details: https://hg.tryton.org/modules/party?cmd=changeset;node=de7becf24ee0
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 27518de37a44 -r de7becf24ee0 configuration.py
--- a/configuration.py Tue Feb 19 22:03:43 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):