changeset 7e0eb53ff51d in modules/company:default
details: https://hg.tryton.org/modules/company?cmd=changeset;node=7e0eb53ff51d
description:
        Remove conversion into selection of company in preferences

        The domain on the field makes the client evaluate it as invalid because
        'parent' has a default value of None and the field is not more 
considered as a
        Many2One.

        issue9433
        review313911002
diffstat:

 res.py |  30 ------------------------------
 1 files changed, 0 insertions(+), 30 deletions(-)

diffs (46 lines):

diff -r ec3711cbd1d9 -r 7e0eb53ff51d res.py
--- a/res.py    Mon Jun 01 10:08:02 2020 +0100
+++ b/res.py    Sat Jun 27 00:55:34 2020 +0200
@@ -1,7 +1,5 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
-import copy
-
 from trytond.model import ModelSQL, fields
 from trytond.pool import PoolMeta, Pool
 from trytond.pyson import Eval
@@ -125,34 +123,6 @@
         return res
 
     @classmethod
-    def get_preferences_fields_view(cls):
-        pool = Pool()
-        Company = pool.get('company.company')
-
-        res = super(User, cls).get_preferences_fields_view()
-        res = copy.deepcopy(res)
-
-        def convert2selection(definition, name):
-            del definition[name]['relation']
-            definition[name]['type'] = 'selection'
-            selection = []
-            definition[name]['selection'] = selection
-            return selection
-
-        if 'company' in res['fields']:
-            selection = convert2selection(res['fields'], 'company')
-            selection.append((None, ''))
-            user = cls(Transaction().user)
-            if user.main_company:
-                companies = Company.search([
-                        ('parent', 'child_of', [user.main_company.id],
-                            'parent'),
-                        ])
-                for company in companies:
-                    selection.append((company.id, company.rec_name))
-        return res
-
-    @classmethod
     def read(cls, ids, fields_names):
         Company = Pool().get('company.company')
         user_id = Transaction().user

Reply via email to