diff --git a/addons/account_cash_basis_base_account/__init__.py b/addons/account_cash_basis_base_account/__init__.py new file mode 100644 index 00000000000..2971a2d9b7f --- /dev/null +++ b/addons/account_cash_basis_base_account/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import account_tax +import account_partial_reconcile diff --git a/addons/account_cash_basis_base_account/__openerp__.py b/addons/account_cash_basis_base_account/__openerp__.py new file mode 100644 index 00000000000..1b012f8c7a0 --- /dev/null +++ b/addons/account_cash_basis_base_account/__openerp__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name' : 'Tax Cash Basis Edit Base Account', + 'version' : '1.0', + 'summary': 'Add a custom account to handle base amount lines', + 'sequence': 5, + 'description': """ +Move the cash basis lines to another account. + """, + 'category': 'Accounting', + 'depends': ['account_tax_cash_basis'], + 'data': [ + 'views/account_tax_views.xml', + ], + 'installable': True, + 'auto_install': True, +} diff --git a/addons/account_cash_basis_base_account/account_partial_reconcile.py b/addons/account_cash_basis_base_account/account_partial_reconcile.py new file mode 100644 index 00000000000..6e51ac61e7a --- /dev/null +++ b/addons/account_cash_basis_base_account/account_partial_reconcile.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from openerp import api, models + + +class AccountPartialReconcileCashBasis(models.Model): + _inherit = 'account.partial.reconcile' + + def _get_tax_cash_basis_base_account(self, line, tax): + if tax.cash_basis_base_account_id: + return tax.cash_basis_base_account_id + return super(AccountPartialReconcileCashBasis, self)._get_tax_cash_basis_base_account(line, tax) diff --git a/addons/account_cash_basis_base_account/account_tax.py b/addons/account_cash_basis_base_account/account_tax.py new file mode 100644 index 00000000000..d8b6c4ca87f --- /dev/null +++ b/addons/account_cash_basis_base_account/account_tax.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +from openerp import api, fields, models + + +class AccountTax(models.Model): + _inherit = 'account.tax' + + 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.') diff --git a/addons/account_cash_basis_base_account/views/account_tax_views.xml b/addons/account_cash_basis_base_account/views/account_tax_views.xml new file mode 100644 index 00000000000..68b076bf853 --- /dev/null +++ b/addons/account_cash_basis_base_account/views/account_tax_views.xml @@ -0,0 +1,15 @@ + + + + + tax.form.cash.basis.base.account.inherit + account.tax + + + + + + + + + diff --git a/addons/account_tax_cash_basis/tax_cash_basis.py b/addons/account_tax_cash_basis/tax_cash_basis.py index 0712a64b485..e58c4b856ff 100644 --- a/addons/account_tax_cash_basis/tax_cash_basis.py +++ b/addons/account_tax_cash_basis/tax_cash_basis.py @@ -39,6 +39,15 @@ class AccountPartialReconcileCashBasis(models.Model): """ Function overwritten in account_tax_exigible to make sure we consider only the lines having tax_exigible set to False """ return False + def _get_tax_cash_basis_base_account(self, line, tax): + ''' Get the account of lines that will contain the base amount of taxes. + + :param line: An account.move.line record + :param tax: An account.tax record + :return: An account record + ''' + return line.account_id + def _get_tax_cash_basis_lines(self, value_before_reconciliation): # Search in account_move if we have any taxes account move lines tax_group = {} @@ -71,19 +80,20 @@ class AccountPartialReconcileCashBasis(models.Model): else: total_by_cash_basis_account[key] = amount if any([tax.use_cash_basis for tax in line.tax_ids]): + account_id = self._get_tax_cash_basis_base_account(line, tax) for tax in line.tax_ids: line_to_create.append((0, 0, { 'name': '/', 'debit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage), 'credit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage), - 'account_id': line.account_id.id, + 'account_id': account_id.id, 'tax_ids': [(6, 0, [tax.id])], })) line_to_create.append((0, 0, { 'name': '/', 'credit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage), 'debit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage), - 'account_id': line.account_id.id, + 'account_id': account_id.id, })) for k, v in tax_group.items():