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

Change test scripts
  • Loading branch information
ByteMeAsap committed Sep 30, 2024
1 parent e11c081 commit e257309
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 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
12 changes: 5 additions & 7 deletions account_reconcile_oca/tests/test_bank_account_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +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"]))
with Form(
bank_stmt_line,
view="account_reconcile_oca.bank_statement_line_form_reconcile_view",
) as f:
f.manual_reference = "account.move.line;%s" % receivable1.id
self.assertEqual(-100, f.manual_amount)
self.assertTrue(
bank_stmt_line.move_id.line_ids.filtered(
lambda r: r.account_id == self.bank_journal_euro.suspense_account_id
)
)

def test_reconcile_invoice_unreconcile(self):
"""
Expand Down

0 comments on commit e257309

Please sign in to comment.