From d35e8d111ba03eddb2cf243414705e72b0b86f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 27 Nov 2024 14:09:07 +0100 Subject: [PATCH] [IMP] account: Create _get_write_off_move_move_line_dict() method to allow extension Related to https://github.com/OCA/account-reconcile/pull/761 TT51885 closes odoo/odoo#188808 Signed-off-by: Thomas Becquevort (thbe) --- .../account/models/account_reconcile_model.py | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index a7c0f92c72b16..ad26b714c8077 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -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' @@ -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