[FIX] account: fix counterpart values of Reconciliation Models for Statement Line with no Partner
- Go to Accounting > Configuration > Reconciliation Models - Create a Reconciliation Model: * Type: Suggest counterpart values * Amount Nature: Amount Paid/Received * Label: Contains test * Counterpart Values: [Add a line with "Percentage of balance" as Amount Type and 100 as Amount, for example] - Create a Bank Statement of any amount with "test" as Label and no Partner - Post Bank Statement and Reconcile it Created Bank Statement matches conditions of Reconciliation Model but Counterpart Values are not suggested. No counterpart values are suggested if there is no Partner on Bank Statement During preparation of reconciliation, reconciliation is skipped because an open balance has to be created but no receivable/payable account is retrieved as there is no Partner on Bank Statement. If no Partner is set, receivable/payable account is retrieved from company. opw-2441484 opw-2442491 closes odoo/odoo#66167 X-original-commit: b9052f30dd8c26e0402a7f4a55b72204e9f1e633 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -1169,6 +1169,12 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
counterpart_vals['account_id'] = open_balance_account.id
|
||||
counterpart_vals['partner_id'] = partner.id
|
||||
else:
|
||||
if self.amount > 0:
|
||||
open_balance_account = self.company_id.partner_id.with_company(self.company_id).property_account_receivable_id
|
||||
else:
|
||||
open_balance_account = self.company_id.partner_id.with_company(self.company_id).property_account_payable_id
|
||||
counterpart_vals['account_id'] = open_balance_account.id
|
||||
|
||||
open_balance_vals = self._prepare_counterpart_move_line_vals(counterpart_vals)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user