summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnh Thao Pham (pta) <pta@odoo.com>2021-02-09 14:19:50 +0000
committerAnh Thao Pham (pta) <pta@odoo.com>2021-02-09 14:19:50 +0000
commitb9052f30dd8c26e0402a7f4a55b72204e9f1e633 (patch)
treed9814f98fda1f3bfb51c7779ac0692cec46a7a0b
parent9a46cc7ad89544a5669b4e5a7ae8b6c31d52eab3 (diff)
[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#65829 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
-rw-r--r--addons/account/models/account_bank_statement.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index e1e3cbfed25..6319e3a1c5d 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -1165,6 +1165,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: