Skip to content

Commit

Permalink
[IMP] account_reconcile_oca: move remaining amount to suspense accoun…
Browse files Browse the repository at this point in the history
…t when marking partially paid invoice as fully paid

Change test scripts
  • Loading branch information
ByteMeAsap committed Sep 30, 2024
1 parent e11c081 commit 6396323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
23 changes: 1 addition & 22 deletions account_reconcile_oca/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,34 +827,13 @@ def button_manual_reference_full_paid(self):
reconcile_auxiliary_id = self.reconcile_data_info["reconcile_auxiliary_id"]
for line in data:
if line["reference"] == manual_reference and line.get("id"):
total_amount = -line["amount"] + line["original_amount_unsigned"]
original_amount = line["original_amount_unsigned"]
reconcile_auxiliary_id, lines = self._get_reconcile_line(
self.env["account.move.line"].browse(line["id"]),
"other",
is_counterpart=True,
reconcile_auxiliary_id=reconcile_auxiliary_id,
max_amount=original_amount,
max_amount=line["original_amount_unsigned"],
)
new_data += lines
new_data.append(
{
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
"id": False,
"account_id": line["account_id"],
"partner_id": line.get("partner_id"),
"date": line["date"],
"name": line["name"],
"amount": -total_amount,
"credit": total_amount if total_amount > 0 else 0.0,
"debit": -total_amount if total_amount < 0 else 0.0,
"kind": "other",
"currency_id": line["currency_id"],
"line_currency_id": line["currency_id"],
"currency_amount": -total_amount,
}
)
reconcile_auxiliary_id += 1
else:
new_data.append(line)
self.reconcile_data_info = self._recompute_suspense_line(
Expand Down
6 changes: 5 additions & 1 deletion account_reconcile_oca/tests/test_bank_account_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ def test_reconcile_invoice_reconcile_full(self):
self.assertEqual(-50, f.manual_amount)
self.assertEqual(2, len(bank_stmt_line.reconcile_data_info["data"]))
bank_stmt_line.button_manual_reference_full_paid()
self.assertEqual(3, len(bank_stmt_line.reconcile_data_info["data"]))
self.assertTrue(
bank_stmt_line.move_id.line_ids.filtered(
lambda r: r.account_id == self.bank_journal_euro.suspense_account_id
)
)
with Form(
bank_stmt_line,
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
Expand Down

0 comments on commit 6396323

Please sign in to comment.