changeset 6afc335a0ef6 in modules/account_payment:default
details: 
https://hg.tryton.org/modules/account_payment?cmd=changeset&node=6afc335a0ef6
description:
        Allow only lines with maturity date to be paid

        issue11364
        review403191002
diffstat:

 CHANGELOG                                   |   1 +
 account.py                                  |   5 +----
 account.xml                                 |   2 +-
 payment.py                                  |   1 +
 tests/scenario_account_payment.rst          |   3 ++-
 tests/scenario_account_payment_planning.rst |  12 ------------
 6 files changed, 6 insertions(+), 18 deletions(-)

diffs (78 lines):

diff -r 88d68ceffdc9 -r 6afc335a0ef6 CHANGELOG
--- a/CHANGELOG Mon Apr 11 20:41:56 2022 +0200
+++ b/CHANGELOG Mon Apr 11 22:23:58 2022 +0200
@@ -1,3 +1,4 @@
+* Allow only lines with maturity date to be paid
 * Allow processing receivable payment without approval
 * Add submitted state to payment
 * Permit to edit amount for manual payment in processing
diff -r 88d68ceffdc9 -r 6afc335a0ef6 account.py
--- a/account.py        Mon Apr 11 20:41:56 2022 +0200
+++ b/account.py        Mon Apr 11 22:23:58 2022 +0200
@@ -419,10 +419,7 @@
             amount=line.payment_amount,
             line=line,
             )
-        date = self.start.date or line.maturity_date
-        # Use default value when empty
-        if date:
-            payment.date = date
+        payment.date = self.start.date or line.maturity_date
         return payment
 
     def do_pay(self, action):
diff -r 88d68ceffdc9 -r 6afc335a0ef6 account.xml
--- a/account.xml       Mon Apr 11 20:41:56 2022 +0200
+++ b/account.xml       Mon Apr 11 22:23:58 2022 +0200
@@ -27,7 +27,7 @@
             <field name="name">Lines to Pay</field>
             <field name="res_model">account.move.line</field>
             <field name="domain"
-                eval="[['OR', ('account.type.receivable', '=', True), 
('account.type.payable', '=', True)], ('party', '!=', None), ('reconciliation', 
'=', None), ('payment_amount', '!=', 0), ('move_state', '=', 'posted')]"
+                eval="[['OR', ('account.type.receivable', '=', True), 
('account.type.payable', '=', True)], ('party', '!=', None), ('reconciliation', 
'=', None), ('payment_amount', '!=', 0), ('move_state', '=', 'posted'), 
('maturity_date', '!=', None)]"
                 pyson="1"/>
             <field name="search_value"
                 eval="[('payment_blocked', '=', False)]" pyson="1"/>
diff -r 88d68ceffdc9 -r 6afc335a0ef6 payment.py
--- a/payment.py        Mon Apr 11 20:41:56 2022 +0200
+++ b/payment.py        Mon Apr 11 22:23:58 2022 +0200
@@ -322,6 +322,7 @@
             If(Eval('state') == 'draft',
                 [
                     ('reconciliation', '=', None),
+                    ('maturity_date', '!=', None),
                     ],
                 []),
             ['OR',
diff -r 88d68ceffdc9 -r 6afc335a0ef6 tests/scenario_account_payment.rst
--- a/tests/scenario_account_payment.rst        Mon Apr 11 20:41:56 2022 +0200
+++ b/tests/scenario_account_payment.rst        Mon Apr 11 22:23:58 2022 +0200
@@ -70,7 +70,8 @@
     >>> Move = Model.get('account.move')
     >>> move = Move()
     >>> move.journal = expense_journal
-    >>> line = move.lines.new(account=payable, party=supplier,
+    >>> line = move.lines.new(
+    ...     account=payable, party=supplier, maturity_date=tomorrow,
     ...     credit=Decimal('50.00'))
     >>> line = move.lines.new(account=expense, debit=Decimal('50.00'))
     >>> move.click('post')
diff -r 88d68ceffdc9 -r 6afc335a0ef6 tests/scenario_account_payment_planning.rst
--- a/tests/scenario_account_payment_planning.rst       Mon Apr 11 20:41:56 
2022 +0200
+++ b/tests/scenario_account_payment_planning.rst       Mon Apr 11 22:23:58 
2022 +0200
@@ -84,15 +84,3 @@
     >>> payment, = Payment.find()
     >>> payment.date == tomorrow
     True
-
-If the line does not have any maturity date it is scheduled for today::
-
-    >>> payment.delete()
-    >>> line.maturity_date = None
-    >>> line.save()
-    >>> pay_line = Wizard('account.move.line.pay', [line])
-    >>> pay_line.execute('next_')
-    >>> pay_line.execute('next_')
-    >>> payment, = line.payments
-    >>> payment.date == today
-    True

Reply via email to