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
  • Loading branch information
victoralmau committed Nov 27, 2024
1 parent 06c0263 commit 16dbc16
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions addons/account/models/account_reconcile_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ def _apply_in_bank_widget(self, residual_amount_currency, partner, st_line):

return aml_vals

def _get_write_off_move_line_dict(self):
return {
'name': self.label,
'account_id': self.account_id.id,
'currency_id': self.company_id.currency_id.id,
'analytic_distribution': self.analytic_distribution,
'reconcile_model_id': self.id,
'journal_id': self.journal_id.id,
'tax_ids': [],
}


class AccountReconcileModel(models.Model):
_name = 'account.reconcile.model'
Expand Down Expand Up @@ -529,19 +540,13 @@ def _get_write_off_move_lines_dict(self, residual_balance, partner_id):
if currency.is_zero(balance):
continue

writeoff_line = {
'name': line.label,
vals = line._get_write_off_move_line_dict()
vals.update({
'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': [],
}
lines_vals_list.append(writeoff_line)
})
lines_vals_list.append(vals)

residual_balance -= balance

Expand Down

0 comments on commit 16dbc16

Please sign in to comment.