From 359d3116c9eb563c4a57ef4a58c5faa111f93657 Mon Sep 17 00:00:00 2001 From: Bernat Brunet Date: Wed, 31 May 2023 18:38:37 +0200 Subject: [PATCH] Fix bug when reschedule the move_lines based on amount. --- account_move_reschedule_line.diff | 20 ++++++++++++++++++++ series | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 account_move_reschedule_line.diff diff --git a/account_move_reschedule_line.diff b/account_move_reschedule_line.diff new file mode 100644 index 0000000..8f0dc9f --- /dev/null +++ b/account_move_reschedule_line.diff @@ -0,0 +1,20 @@ +diff --git a/tryton/modules/account/move.py b/tryton/modules/account/move.py +index e9123a42a9..f8a7d3209c 100644 +--- a/tryton/modules/account/move.py ++++ b/tryton/modules/account/move.py +@@ -2348,12 +2348,14 @@ class RescheduleLines(Wizard): + and self.start.interval + and self.start.currency): + remaining = self.start.total_amount ++ total = self.start.total_amount + date = self.start.start_date + values['terms'] = terms = [] + if self.start.amount: + interval = self.start.interval + amount = self.start.amount.copy_sign(remaining) +- while remaining - amount > 0: ++ while ((total > 0 and remaining - amount > 0) ++ or (total < 0 and remaining - amount < 0)): + terms.append({ + 'date': date, + 'amount': amount, diff --git a/series b/series index f372955..6aed3ef 100644 --- a/series +++ b/series @@ -57,3 +57,5 @@ issue11306.diff # [analytic_invocie] Add compatibility between the analytic_invo strftime_format.diff # [ir] Fix problem with strftime format, reducing the time needed to format standard time. When the %A or %B is not used. counterpart_party_payment_clearing.diff # [account_payment_clearing] Add the possiblity to have a party in the counterpart move when reconcile on a payment. + +account_move_reschedule_line.diff # [account] Fix bug when reschedule the move_lines based on amount.