[FIX] account: don't set default taxes on exchange rate difference accounts

closes odoo/odoo#36332

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Olivier Colson
2019-09-05 10:01:57 +00:00
committed by oco-odoo
parent 5eedaad33d
commit 93fa283020
+3 -3
View File
@@ -653,10 +653,10 @@ class AccountChartTemplate(models.Model):
sale_tax = self.env['account.tax.template'].search([('type_tax_use', '=', 'sale'), ('chart_template_id', 'in', all_parents)], limit=1)
purchase_tax = self.env['account.tax.template'].search([('type_tax_use', '=', 'purchase'), ('chart_template_id', 'in', all_parents)], limit=1)
for account_template in acc_template:
# Adding a tax by default on each income or expense account.
if account_template.user_type_id.internal_group == 'income':
# Adding a tax by default on each income or expense account, if they are not used for exchange difference.
if account_template.user_type_id.internal_group == 'income' and account_template != self.income_currency_exchange_account_id:
account_template.tax_ids = sale_tax
elif account_template.user_type_id.internal_group == 'expense':
elif account_template.user_type_id.internal_group == 'expense' and account_template != self.expense_currency_exchange_account_id:
account_template.tax_ids = purchase_tax
code_main = account_template.code and len(account_template.code) or 0
code_acc = account_template.code or ''