[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 <pimodoo@users.noreply.github.com>
This commit is contained in:
Josse Colpaert
2019-10-02 10:16:26 +00:00
parent d46befdf25
commit 8ba449ccdd
+5 -2
View File
@@ -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