changeset 19959855edb6 in modules/company:default
details: https://hg.tryton.org/modules/company?cmd=changeset&node=19959855edb6
description:
        Add language to contact mechanism

        issue10223
        review349611002
diffstat:

 __init__.py |   1 +
 party.py    |  11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r bba2953e5260 -r 19959855edb6 __init__.py
--- a/__init__.py       Sat Apr 10 23:46:23 2021 +0200
+++ b/__init__.py       Sun Apr 11 18:37:41 2021 +0200
@@ -31,6 +31,7 @@
         party.Party,
         party.PartyLang,
         party.ContactMechanism,
+        party.ContactMechanismLanguage,
         module='company', type_='model')
     Pool.register(
         company.CompanyConfig,
diff -r bba2953e5260 -r 19959855edb6 party.py
--- a/party.py  Sat Apr 10 23:46:23 2021 +0200
+++ b/party.py  Sun Apr 11 18:37:41 2021 +0200
@@ -116,6 +116,17 @@
                     yield address.country.code
 
 
+class ContactMechanismLanguage(CompanyValueMixin, metaclass=PoolMeta):
+    __name__ = 'party.contact_mechanism.language'
+
+    @classmethod
+    def __setup__(cls):
+        super().__setup__()
+        cls.contact_mechanism.context['company'] = Eval('company', -1)
+        if 'company' not in cls.contact_mechanism.depends:
+            cls.contact_mechanism.depends.append('company')
+
+
 class LetterReport(CompanyReport):
     __name__ = 'party.letter'
 

Reply via email to