changeset f2b601fdb747 in modules/account_dunning:default
details:
https://hg.tryton.org/modules/account_dunning?cmd=changeset&node=f2b601fdb747
description:
Send only the required fields when fetching a readonly view definition
issue11134
review380081002
diffstat:
dunning.py | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (70 lines):
diff -r e3dfda5dc2af -r f2b601fdb747 dunning.py
--- a/dunning.py Wed Apr 06 23:37:41 2022 +0200
+++ b/dunning.py Fri Apr 08 19:07:12 2022 +0200
@@ -71,7 +71,6 @@
_STATES = {
'readonly': Eval('state') != 'draft',
}
-_DEPENDS = ['state']
class Dunning(ModelSQL, ModelView):
@@ -80,7 +79,7 @@
company = fields.Many2One('company.company', 'Company', required=True,
help="Make the dunning belong to the company.",
select=True,
- states=_STATES, depends=_DEPENDS)
+ states=_STATES)
line = fields.Many2One('account.move.line', 'Line', required=True,
help="The receivable line to dun for.",
domain=[
@@ -91,27 +90,25 @@
('credit', '<', 0),
],
],
- states=_STATES, depends=_DEPENDS + ['company'])
+ states=_STATES)
procedure = fields.Many2One('account.dunning.procedure', 'Procedure',
- required=True, states=_STATES, depends=_DEPENDS)
+ required=True, states=_STATES)
level = fields.Many2One('account.dunning.level', 'Level', required=True,
domain=[
('procedure', '=', Eval('procedure', -1)),
],
- states=_STATES, depends=_DEPENDS + ['procedure'])
+ states=_STATES)
date = fields.Date(
"Date", readonly=True,
states={
'invisible': Eval('state') == 'draft',
},
- depends=['state'],
help="When the dunning reached the level.")
age = fields.Function(fields.TimeDelta(
"Age",
states={
'invisible': Eval('state') == 'draft',
},
- depends=['state'],
help="How long the dunning has been at the level."),
'get_age')
blocked = fields.Boolean('Blocked',
@@ -128,7 +125,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company']),
+ depends={'company'}),
'get_line_field', searcher='search_line_field')
amount = fields.Function(Monetary(
"Amount", currency='currency', digits='currency'),
@@ -142,8 +139,7 @@
currency='second_currency', digits='second_currency',
states={
'invisible': Eval('currency') == Eval('second_currency'),
- },
- depends=['currency', 'second_currency']),
+ }),
'get_amount_second_currency')
second_currency = fields.Function(fields.Many2One('currency.currency',
'Second Currency'), 'get_second_currency')