changeset 0e17f2a68996 in modules/company:default details: https://hg.tryton.org/modules/company?cmd=changeset&node=0e17f2a68996 description: Send only the required fields when fetching a readonly view definition
issue11134 review380081002 diffstat: company.py | 6 +----- model.py | 3 +-- party.py | 6 ++---- res.py | 3 --- 4 files changed, 4 insertions(+), 14 deletions(-) diffs (103 lines): diff -r 4da3600d6e64 -r 0e17f2a68996 company.py --- a/company.py Wed Apr 06 23:37:42 2022 +0200 +++ b/company.py Fri Apr 08 19:07:13 2022 +0200 @@ -55,7 +55,7 @@ 'company': If( Eval('company', -1) >= 0, Eval('company', None), None), }, - depends=['company'], + depends={'company'}, help="The party which represents the employee.") company = fields.Many2One('company.company', 'Company', required=True, help="The company to which the employee belongs.") @@ -65,7 +65,6 @@ (), ) ], - depends=['end_date'], help="When the employee joins the company.") end_date = fields.Date('End Date', domain=[If((Eval('start_date')) & (Eval('end_date')), @@ -73,21 +72,18 @@ (), ) ], - depends=['start_date'], help="When the employee leaves the company.") supervisor = fields.Many2One( 'company.employee', "Supervisor", domain=[ ('company', '=', Eval('company', -1)), ], - depends=['company'], help="The employee who oversees this employee.") subordinates = fields.One2Many( 'company.employee', 'supervisor', "Subordinates", domain=[ ('company', '=', Eval('company', -1)), ], - depends=['company'], help="The employees to be overseen by this employee.") @staticmethod diff -r 4da3600d6e64 -r 0e17f2a68996 model.py --- a/model.py Wed Apr 06 23:37:42 2022 +0200 +++ b/model.py Fri Apr 08 19:07:13 2022 +0200 @@ -52,8 +52,7 @@ domain=[('company', '=', Eval(company, -1))], states={ 'readonly': Eval('state').in_(states), - }, - depends=[company, 'state']) + }) def set_employee(field, company='company'): diff -r 4da3600d6e64 -r 0e17f2a68996 party.py --- a/party.py Wed Apr 06 23:37:42 2022 +0200 +++ b/party.py Fri Apr 08 19:07:13 2022 +0200 @@ -44,8 +44,7 @@ def __setup__(cls): super().__setup__() cls.party.context['company'] = Eval('company', -1) - if 'company' not in cls.party.depends: - cls.party.depends.append('company') + cls.party.depends.add('company') @classmethod def __register__(cls, module_name): @@ -123,8 +122,7 @@ 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') + cls.contact_mechanism.depends.add('company') class LetterReport(Report): diff -r 4da3600d6e64 -r 0e17f2a68996 res.py --- a/res.py Wed Apr 06 23:37:42 2022 +0200 +++ b/res.py Fri Apr 08 19:07:13 2022 +0200 @@ -39,21 +39,18 @@ domain=[ ('id', 'in', Eval('companies', [])), ], - depends=['companies'], help="Select the company to work for.") employees = fields.Many2Many('res.user-company.employee', 'user', 'employee', 'Employees', domain=[ ('company', 'in', Eval('companies', [])), ], - depends=['companies'], help="Add employees to grant the user access to them.") employee = fields.Many2One('company.employee', 'Current Employee', domain=[ ('company', '=', Eval('company', -1)), ('id', 'in', Eval('employees', [])), ], - depends=['company', 'employees'], help="Select the employee to make the user behave as such.") company_filter = fields.Selection([ ('one', "Current"),