From bfe362c87a2c058c9257166dca096d80c79d3dc3 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Thu, 29 Mar 2018 18:15:38 +0200 Subject: [PATCH] [IMP] account: allow choosing a cash basis taxes account for base amount When using cash basis taxes, the user has now the possibility to select a cash basis account containing the base amount during the generation of accounting entries. This commit has been backported in v9 (in form of a module) in revision 1631889e917b29066e4fb8f2d851723927bd35ff - task: https://www.odoo.com/web#id=40284&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720 - Was PR #22599 --- addons/account/models/account.py | 8 +++++++- addons/account/models/account_move.py | 2 +- addons/account/models/chart_template.py | 5 +++++ addons/account/views/account_view.xml | 1 + addons/l10n_fr/data/account_tax_data.xml | 12 ++++++------ addons/l10n_mx/data/account_tax_data.xml | 16 ++++++++-------- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index e292ed69818..63d96de9aff 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -809,11 +809,17 @@ class AccountTax(models.Model): oldname='use_cash_basis', help="Based on Invoice: the tax is due as soon as the invoice is validated.\n" "Based on Payment: the tax is due as soon as the payment of the invoice is received.") - cash_basis_account = fields.Many2one( + cash_basis_account_id = fields.Many2one( 'account.account', string='Tax Received Account', domain=[('deprecated', '=', False)], + oldname='cash_basis_account', help='Account used as counterpart for the journal entry, for taxes eligible based on payments.') + cash_basis_base_account_id = fields.Many2one( + 'account.account', + domain=[('deprecated', '=', False)], + string='Base Tax Received Account', + help='Account that will be set on lines created in cash basis journal entry and used to keep track of the tax base amount.') _sql_constraints = [ ('name_company_uniq', 'unique(name, company_id, type_tax_use)', 'Tax names must be unique !'), diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 6b62949c332..6067d78c5cf 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1329,7 +1329,7 @@ class AccountPartialReconcile(models.Model): :param tax: An account.tax record :return: An account record ''' - return line.account_id + return tax.cash_basis_base_account_id or line.account_id def create_tax_cash_basis_entry(self, percentage_before_rec): self.ensure_one() diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index d035fe594dc..5f5c38317b3 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -538,6 +538,11 @@ class AccountTaxTemplate(models.Model): string='Tax Received Account', domain=[('deprecated', '=', False)], help='Account used as counterpart for the journal entry, for taxes eligible based on payments.') + cash_basis_base_account_id = fields.Many2one( + 'account.account.template', + domain=[('deprecated', '=', False)], + string='Base Tax Received Account', + help='Account that will be set on lines created in cash basis journal entry and used to keep track of the tax base amount.') _sql_constraints = [ ('name_company_uniq', 'unique(name, company_id, type_tax_use, chart_template_id)', 'Tax names must be unique !'), diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 4c8f7845379..c439cb91ba0 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -1128,6 +1128,7 @@ + diff --git a/addons/l10n_fr/data/account_tax_data.xml b/addons/l10n_fr/data/account_tax_data.xml index 4ec5e434cd8..5fb51c92067 100644 --- a/addons/l10n_fr/data/account_tax_data.xml +++ b/addons/l10n_fr/data/account_tax_data.xml @@ -515,7 +515,7 @@ on_payment - + sale @@ -573,7 +573,7 @@ on_payment - + sale @@ -603,7 +603,7 @@ on_payment - + sale @@ -637,7 +637,7 @@ on_payment - + sale @@ -699,7 +699,7 @@ on_payment - + sale @@ -731,7 +731,7 @@ on_payment - + sale diff --git a/addons/l10n_mx/data/account_tax_data.xml b/addons/l10n_mx/data/account_tax_data.xml index 168b1955609..02d65cbeb29 100644 --- a/addons/l10n_mx/data/account_tax_data.xml +++ b/addons/l10n_mx/data/account_tax_data.xml @@ -47,7 +47,7 @@ on_payment - + @@ -62,7 +62,7 @@ on_payment - + @@ -76,7 +76,7 @@ on_payment - + @@ -91,7 +91,7 @@ on_payment - + @@ -130,7 +130,7 @@ on_payment - + @@ -145,7 +145,7 @@ on_payment - + @@ -160,7 +160,7 @@ on_payment - + @@ -175,7 +175,7 @@ on_payment - +