Skip to content

Commit

Permalink
[IMP] account_reconcile_model_oca: Create _get_write_off_move_move_li…
Browse files Browse the repository at this point in the history
…ne_dict() method to allow extension

FWP from 16.0: odoo/odoo#188808

Related to OCA#761

TT51885
  • Loading branch information
victoralmau committed Jan 28, 2025
1 parent d08070c commit 157d230
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions account_reconcile_model_oca/models/account_reconcile_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,7 @@ def _get_write_off_move_lines_dict(self, residual_balance, partner_id):
if currency.is_zero(balance):
continue

writeoff_line = {
"name": line.label,
"balance": balance,
"debit": balance > 0 and balance or 0,
"credit": balance < 0 and -balance or 0,
"account_id": line.account_id.id,
"currency_id": currency.id,
"analytic_distribution": line.analytic_distribution,
"reconcile_model_id": self.id,
"journal_id": line.journal_id.id,
"tax_ids": [],
}
writeoff_line = line._get_write_off_move_line_dict(balance, currency)
lines_vals_list.append(writeoff_line)

residual_balance -= balance
Expand Down Expand Up @@ -688,3 +677,22 @@ def _check_rule_propositions(self, st_line, amls_values_list):
return {"allow_write_off", "allow_auto_reconcile"}

return {"rejected"}


class AccountReconcileModelLine(models.Model):
_inherit = "account.reconcile.model.line"

def _get_write_off_move_line_dict(self, balance, currency):
self.ensure_one()
return {
"name": self.label,
"balance": balance,
"debit": balance > 0 and balance or 0,
"credit": balance < 0 and -balance or 0,
"account_id": self.account_id.id,
"currency_id": currency.id,
"analytic_distribution": self.analytic_distribution,
"reconcile_model_id": self.model_id.id,
"journal_id": self.journal_id.id,
"tax_ids": [],
}

0 comments on commit 157d230

Please sign in to comment.