Skip to content

Commit

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

Related to OCA/account-reconcile#761

TT51885

closes odoo#188808

Signed-off-by: Thomas Becquevort (thbe) <[email protected]>
  • Loading branch information
victoralmau authored and docker-odoo committed Jan 28, 2025
1 parent 7f09798 commit 08adc81
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions addons/account/models/account_reconcile_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ def _apply_in_bank_widget(self, residual_amount_currency, partner, st_line):

return aml_vals

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': [],
}


class AccountReconcileModel(models.Model):
_name = 'account.reconcile.model'
Expand Down Expand Up @@ -529,18 +544,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

0 comments on commit 08adc81

Please sign in to comment.