From 8bb9869812e85aa842d9f168c837ddde8e0b75f3 Mon Sep 17 00:00:00 2001 From: Luis Torres Date: Tue, 23 May 2017 11:34:48 +0200 Subject: [PATCH] [FIX] l10n_mx: set cash basis configuration in taxes. Courtesy of Vauxoo. Was PR #17055 --- addons/l10n_mx/data/account_tax_data.xml | 16 ++++++++++ addons/l10n_mx/models/chart_template.py | 38 ------------------------ 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/addons/l10n_mx/data/account_tax_data.xml b/addons/l10n_mx/data/account_tax_data.xml index 8bd16cf1dc7..6cf8c3d0589 100644 --- a/addons/l10n_mx/data/account_tax_data.xml +++ b/addons/l10n_mx/data/account_tax_data.xml @@ -26,6 +26,8 @@ + + @@ -39,6 +41,8 @@ + + @@ -51,6 +55,8 @@ + + @@ -63,6 +69,8 @@ + + @@ -99,6 +107,8 @@ + + @@ -111,6 +121,8 @@ + + @@ -123,6 +135,8 @@ + + @@ -135,6 +149,8 @@ + + diff --git a/addons/l10n_mx/models/chart_template.py b/addons/l10n_mx/models/chart_template.py index 155877b2761..4e1397073ba 100644 --- a/addons/l10n_mx/models/chart_template.py +++ b/addons/l10n_mx/models/chart_template.py @@ -8,44 +8,6 @@ from odoo import models, api, _ class AccountChartTemplate(models.Model): _inherit = "account.chart.template" - @api.multi - def _load_template( - self, company, code_digits=None, transfer_account_id=None, - account_ref=None, taxes_ref=None): - """ - Set the 'use_cash_basis' and 'cash_basis_account' fields on account.account. This hack is needed due to the fact - that the tax template does not have the fields 'use_cash_basis' and 'cash_basis_account'. - - This hunk should be removed in master, as the account_tax_cash_basis module has been merged already in account - module - """ - self.ensure_one() - accounts, taxes = super(AccountChartTemplate, self)._load_template( - company, code_digits=code_digits, - transfer_account_id=transfer_account_id, account_ref=account_ref, - taxes_ref=taxes_ref) - if not self == self.env.ref('l10n_mx.mx_coa'): - return accounts, taxes - account_tax_obj = self.env['account.tax'] - account_obj = self.env['account.account'] - taxes_acc = { - 'IVA': account_obj.search([('code', '=', '208.01.01')]), - 'ITAXR_04-OUT': account_obj.search([('code', '=', '216.10.20')]), - 'ITAXR_10-OUT': account_obj.search([('code', '=', '216.10.20')]), - 'ITAX_1067-OUT': account_obj.search([('code', '=', '216.10.20')]), - 'ITAX_167-OUT': account_obj.search([('code', '=', '216.10.20')]), - 'ITAX_010-OUT': account_obj.search([('code', '=', '208.01.01')]), - 'ITAX_160-OUT': account_obj.search([('code', '=', '208.01.01')])} - - for tax in self.tax_template_ids: - if tax.description not in taxes_acc: - continue - account_tax_obj.browse(taxes.get(tax.id)).write({ - 'use_cash_basis': True, - 'cash_basis_account': taxes_acc.get(tax.description).id, - }) - return accounts, taxes - @api.model def generate_journals(self, acc_template_ref, company, journals_dict=None): """Set the tax_cash_basis_journal_id on the company"""