[FIX] account: Find correctly taxes when using hierarchical charts of accounts. Courtesy of pedrobaeza. PR #11493

This commit is contained in:
qdp-odoo
2016-04-11 18:18:12 +02:00
parent 9807ff8a91
commit b2a321a878
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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
+2 -2
View File
@@ -56,13 +56,13 @@
<div attrs="{'invisible': ['|', '|', ('chart_template_id','=',False), ('complete_tax_set','=',False), ('has_chart_of_accounts','!=',False)]}">
<label for="sale_tax_id"/>
<field name="sale_tax_id"
domain="[('chart_template_id', '=', chart_template_id),('type_tax_use','in',('sale','all'))]"
domain="[('chart_template_id', 'parent_of', chart_template_id),('type_tax_use','in',('sale','all'))]"
class="oe_inline"/>
</div>
<div attrs="{'invisible': ['|', '|', ('chart_template_id','=',False), ('complete_tax_set','=',False), ('has_chart_of_accounts','!=',False)]}">
<label for="purchase_tax_id"/>
<field name="purchase_tax_id"
domain="[('chart_template_id', '=', chart_template_id),('type_tax_use','in',('purchase', 'all'))]"
domain="[('chart_template_id', 'parent_of', chart_template_id),('type_tax_use','in',('purchase', 'all'))]"
class="oe_inline"/>
</div>
<div attrs="{'invisible': ['|', '|', ('chart_template_id','=',False), ('complete_tax_set','=',True), ('has_chart_of_accounts','!=',False)]}">