changeset d4cc8be5faaa in modules/analytic_account:default
details:
https://hg.tryton.org/modules/analytic_account?cmd=changeset&node=d4cc8be5faaa
description:
Send only the required fields when fetching a readonly view definition
issue11134
review380081002
diffstat:
account.py | 24 ++++++++----------------
line.py | 3 +--
rule.py | 8 +++-----
3 files changed, 12 insertions(+), 23 deletions(-)
diffs (132 lines):
diff -r 4f8c0af4bd6b -r d4cc8be5faaa account.py
--- a/account.py Wed Apr 06 23:37:42 2022 +0200
+++ b/account.py Fri Apr 08 19:07:12 2022 +0200
@@ -47,8 +47,7 @@
states={
'invisible': Eval('type') == 'root',
'required': Eval('type') != 'root',
- },
- depends=['company', 'type'])
+ })
parent = fields.Many2One('analytic_account.account', 'Parent', select=True,
domain=['OR',
('root', '=', Eval('root', -1)),
@@ -57,16 +56,14 @@
states={
'invisible': Eval('type') == 'root',
'required': Eval('type') != 'root',
- },
- depends=['root', 'type'])
+ })
childs = fields.One2Many('analytic_account.account', 'parent', 'Children',
states={
'invisible': Eval('id', -1) < 0,
},
domain=[
('company', '=', Eval('company', -1)),
- ],
- depends=['company'])
+ ])
balance = fields.Function(Monetary(
"Balance", currency='currency', digits='currency'),
'get_balance')
@@ -88,8 +85,7 @@
states={
'invisible': Eval('type') != 'distribution',
'required': Eval('type') == 'distribution',
- },
- depends=['type'])
+ })
distribution_parents = fields.Many2Many(
'analytic_account.account.distribution', 'account', 'parent',
"Distribution Parents", readonly=True)
@@ -338,8 +334,7 @@
'analytic_account.account', "Account", required=True,
domain=[
('root', '=', Eval('root', -1)),
- ],
- depends=['root'])
+ ])
ratio = fields.Numeric("Ratio", required=True,
domain=[
('ratio', '>=', 0),
@@ -369,15 +364,13 @@
(),
('company', '=', Eval('company', -1))),
('type', '=', 'root'),
- ],
- depends=['company'])
+ ])
account = fields.Many2One('analytic_account.account', 'Account',
ondelete='RESTRICT',
domain=[
('root', '=', Eval('root')),
('type', 'in', ['normal', 'distribution']),
- ],
- depends=['root', 'company'])
+ ])
company = fields.Function(fields.Many2One('company.company', 'Company'),
'on_change_with_company', searcher='search_company')
@@ -463,8 +456,7 @@
__slots__ = ()
analytic_accounts = fields.One2Many('analytic.account.entry', 'origin',
'Analytic Accounts',
- size=Eval('analytic_accounts_size', 0),
- depends=['analytic_accounts_size'])
+ size=Eval('analytic_accounts_size', 0))
analytic_accounts_size = fields.Function(fields.Integer(
'Analytic Accounts Size'), 'get_analytic_accounts_size')
diff -r 4f8c0af4bd6b -r d4cc8be5faaa line.py
--- a/line.py Wed Apr 06 23:37:42 2022 +0200
+++ b/line.py Fri Apr 08 19:07:12 2022 +0200
@@ -33,8 +33,7 @@
('company', '=', None),
('company', '=', Eval('company', -1)),
],
- ],
- depends=['company'])
+ ])
move_line = fields.Many2One('account.move.line', 'Account Move Line',
ondelete='CASCADE', required=True)
date = fields.Date('Date', required=True)
diff -r 4f8c0af4bd6b -r d4cc8be5faaa rule.py
--- a/rule.py Wed Apr 06 23:37:42 2022 +0200
+++ b/rule.py Fri Apr 08 19:07:12 2022 +0200
@@ -19,8 +19,7 @@
domain=[
('company', '=', Eval('company', -1)),
('type', '!=', 'view'),
- ],
- depends=['company'])
+ ])
party = fields.Many2One(
'party.party', "Party",
states={
@@ -29,7 +28,7 @@
context={
'company': Eval('company', -1),
},
- depends=['party_visible', 'company'])
+ depends={'company'})
party_visible = fields.Function(fields.Boolean("Party Visible"),
'on_change_with_party_visible')
journal = fields.Many2One(
@@ -37,7 +36,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
@classmethod
def __setup__(cls):
@@ -45,7 +44,6 @@
cls.analytic_accounts.domain = [
('company', '=', Eval('company', -1)),
]
- cls.analytic_accounts.depends.append('company')
@classmethod
def default_company(cls):