From 8ba449ccddce3e46e2d5115151bdbfbd06f2c56d Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 2 Oct 2019 10:16:08 +0000 Subject: [PATCH] [FIX] account: pos receivable account might be only set on the parent On installation of the CoA the company's pos receivable account is set, but it is possible that the account is not set on the chart template itself, but on its parent. closes odoo/odoo#37761 Signed-off-by: pimodoo --- addons/account/models/chart_template.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index abe030637f2..b011a0914ce 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -232,9 +232,12 @@ class AccountChartTemplate(models.Model): }) # Set default PoS receivable account in company - if acc_template_ref.get(self.default_pos_receivable_account_id.id): + default_pos_receivable = self.default_pos_receivable_account_id.id + if not default_pos_receivable and self.parent_id: + default_pos_receivable = self.parent_id.default_pos_receivable_account_id.id + if acc_template_ref.get(default_pos_receivable): company.write({ - 'account_default_pos_receivable_account_id': acc_template_ref[self.default_pos_receivable_account_id.id] + 'account_default_pos_receivable_account_id': acc_template_ref[default_pos_receivable] }) # Set the transfer account on the company