From b2a321a87828c36309410fb2b72c5ffa5d2258a0 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Mon, 11 Apr 2016 14:12:39 +0200 Subject: [PATCH] [FIX] account: Find correctly taxes when using hierarchical charts of accounts. Courtesy of pedrobaeza. PR #11493 --- addons/account/models/chart_template.py | 2 +- addons/account/models/res_config.py | 4 ++-- addons/account/views/res_config_view.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 5b5cf98497b..8f250456522 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -596,7 +596,7 @@ class WizardMultiChartsAccounts(models.TransientModel): if self.chart_template_id.complete_tax_set: # default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account chart_ids = self._get_chart_parent_ids(self.chart_template_id) - base_tax_domain = [('chart_template_id', 'in', chart_ids)] + base_tax_domain = [('chart_template_id', 'parent_of', chart_ids)] sale_tax_domain = base_tax_domain + [('type_tax_use', '=', 'sale')] purchase_tax_domain = base_tax_domain + [('type_tax_use', '=', 'purchase')] sale_tax = tax_templ_obj.search(sale_tax_domain, order="sequence, id desc", limit=1) diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index 237f2655f36..16aa3c7ff5c 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -182,10 +182,10 @@ class AccountConfigSettings(models.TransientModel): ir_values_obj = self.env['ir.values'] # default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account sale_tax = tax_templ_obj.search( - [('chart_template_id', '=', self.chart_template_id.id), ('type_tax_use', '=', 'sale')], limit=1, + [('chart_template_id', 'parent_of', self.chart_template_id.id), ('type_tax_use', '=', 'sale')], limit=1, order="sequence, id desc") purchase_tax = tax_templ_obj.search( - [('chart_template_id', '=', self.chart_template_id.id), ('type_tax_use', '=', 'purchase')], limit=1, + [('chart_template_id', 'parent_of', self.chart_template_id.id), ('type_tax_use', '=', 'purchase')], limit=1, order="sequence, id desc") self.sale_tax_id = sale_tax self.purchase_tax_id = purchase_tax diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml index 25de6aed4e4..b57d17fa9e8 100644 --- a/addons/account/views/res_config_view.xml +++ b/addons/account/views/res_config_view.xml @@ -56,13 +56,13 @@