changeset 9a2b0ae5129e in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=9a2b0ae5129e
description:
        Require date to test payment term

        Since rev 44c2a67ad783 a date is required to compute the payment terms.

        issue11625
        review425511013
diffstat:

 payment_term.py |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 2b3082c7f067 -r 9a2b0ae5129e payment_term.py
--- a/payment_term.py   Sat Aug 06 10:31:57 2022 +0200
+++ b/payment_term.py   Mon Aug 08 22:25:23 2022 +0200
@@ -53,8 +53,6 @@
         with (date, amount) for each payment term line.
 
         amount must be a Decimal used for the calculation.
-        If specified, date will be used as the start date, otherwise current
-        date will be used.
         """
         # TODO implement business_days
         # http://pypi.python.org/pypi/BusinessHours/
@@ -356,13 +354,17 @@
     __name__ = 'account.invoice.payment_term.test'
     payment_term = fields.Many2One('account.invoice.payment_term',
         'Payment Term', required=True)
-    date = fields.Date('Date')
+    date = fields.Date("Date", required=True)
     amount = Monetary(
         "Amount", currency='currency', digits='currency', required=True)
     currency = fields.Many2One('currency.currency', 'Currency', required=True)
     result = fields.One2Many('account.invoice.payment_term.test.result',
         None, 'Result', readonly=True)
 
+    @classmethod
+    def default_date(cls):
+        return Pool().get('ir.date').today()
+
     @staticmethod
     def default_currency():
         pool = Pool()
@@ -376,7 +378,7 @@
         pool = Pool()
         Result = pool.get('account.invoice.payment_term.test.result')
         result = []
-        if (self.payment_term and self.amount and self.currency):
+        if (self.payment_term and self.amount and self.currency and self.date):
             for date, amount in self.payment_term.compute(
                     self.amount, self.currency, self.date):
                 result.append(Result(

Reply via email to