changeset 4f9b64692892 in modules/account:default
details: https://hg.tryton.org/modules/account?cmd=changeset&node=4f9b64692892
description:
Allow only lines with maturity date to be paid
issue11364
review403191002
diffstat:
move.py | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 8cce6db44076 -r 4f9b64692892 move.py
--- a/move.py Mon Apr 11 21:09:28 2022 +0200
+++ b/move.py Mon Apr 11 22:23:58 2022 +0200
@@ -818,9 +818,16 @@
depends={'company'}, ondelete='RESTRICT')
party_required = fields.Function(fields.Boolean('Party Required'),
'on_change_with_party_required')
- maturity_date = fields.Date('Maturity Date',
- help='This field is used for payable and receivable lines. \n'
- 'You can put the limit date for the payment.')
+ maturity_date = fields.Date(
+ "Maturity Date",
+ states={
+ 'invisible': ~Eval('has_maturity_date'),
+ },
+ depends=['has_maturity_date'],
+ help="Set a date to make the line payable or receivable.")
+ has_maturity_date = fields.Function(
+ fields.Boolean("Has Maturity Date"),
+ 'on_change_with_has_maturity_date')
state = fields.Selection([
('draft', 'Draft'),
('valid', 'Valid'),
@@ -1035,6 +1042,12 @@
if self.move:
return self.move.state
+ @fields.depends('account')
+ def on_change_with_has_maturity_date(self, name=None):
+ if self.account:
+ type_ = self.account.type
+ return type_.receivable or type_.payable
+
order_journal = MoveLineMixin._order_move_field('journal')
order_period = MoveLineMixin._order_move_field('period')
order_company = MoveLineMixin._order_move_field('company')