Fix bug when calculate the account moves in the account_invoice_defer

module.
This commit is contained in:
Bernat Brunet 2023-05-25 06:41:37 +02:00
parent 46bdca4e89
commit 01fe3193f3
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
diff --git a/tryton/modules/account_invoice_defer/account.py b/modules/account_invoice_defer/account.py
index e56541bdc0..f1e0c37206 100644
--- a/tryton/modules/account_invoice_defer/account.py
+++ b/tryton/modules/account_invoice_defer/account.py
@@ -272,10 +272,9 @@ class InvoiceDeferred(Workflow, ModelSQL, ModelView):
if remainder:
for line in last_move.lines:
if line.debit:
- line.debit -= remainder
+ line.debit += remainder
else:
line.credit -= remainder
- last_move.lines = last_move.lines
to_save.append(last_move)
Move.save(to_save)
Move.post(moves)
@@ -287,12 +286,12 @@ class InvoiceDeferred(Workflow, ModelSQL, ModelView):
@property
def amount_remainder(self):
- balance = 0
+ balance = self.amount
for move in self.moves:
income_account = self.invoice_line.account.current(move.date)
for line in move.lines:
if line.account == income_account:
- balance += line.debit - line.credit
+ balance -= line.debit - line.credit
return balance
def get_move(self, period=None):

2
series
View File

@ -51,9 +51,9 @@ issue12116.diff # [sale] Return sale using a single copy call
issue12226.diff # [sale_credit_limit] Do not deduce negative sale quantities from credit amount
account_invoice_defer.diff # [account_invoice_defer] Fix problem when calcaulte the account moves
issue11306.diff # [analytic_invocie] Add compatibility between the analytic_invocie module and the account_invoice_defer module
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.