diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index c6f1a7f5cf5..5171429f868 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -64,6 +64,8 @@ You could use this simplified accounting in case you work with an (external) acc 'views/report_financial.xml', 'wizard/account_report_aged_partner_balance_view.xml', 'views/report_agedpartnerbalance.xml', + 'views/tax_adjustments.xml', + 'wizard/wizard_tax_adjustments_view.xml', ], 'demo': [ 'demo/account_demo.xml', diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 0d7a2bfd082..8259d7b4b5b 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -522,6 +522,7 @@ class AccountTax(models.Model): name = fields.Char(string='Tax Name', required=True, translate=True) type_tax_use = fields.Selection([('sale', 'Sales'), ('purchase', 'Purchases'), ('none', 'None')], string='Tax Scope', required=True, default="sale", help="Determines where the tax is selectable. Note : 'None' means a tax can't be used by itself, however it can still be used in a group.") + tax_adjustment = fields.Boolean(help='Set this field to true if this tax can be used in the tax adjustment wizard, used to manually fill some data in the tax declaration') amount_type = fields.Selection(default='percent', string="Tax Computation", required=True, oldname='type', selection=[('group', 'Group of Taxes'), ('fixed', 'Fixed'), ('percent', 'Percentage of Price'), ('division', 'Percentage of Price Tax Included')]) active = fields.Boolean(default=True, help="Set active to false to hide the tax without removing it.") diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 8a24db2f1c0..dcb4beb7e54 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -8,6 +8,7 @@ from openerp.exceptions import RedirectWarning, UserError, ValidationError from openerp.tools.misc import formatLang from openerp.tools import float_is_zero, float_compare from openerp.tools.safe_eval import safe_eval +from lxml import etree #---------------------------------------------------------- # Entries @@ -93,6 +94,14 @@ class AccountMove(models.Model): # Dummy Account field to search on account.move by account_id dummy_account_id = fields.Many2one('account.account', related='line_ids.account_id', string='Account', store=False) + @api.model + def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): + res = super(AccountMove, self).fields_view_get( + view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu) + if self._context.get('vat_domain'): + res['fields']['line_ids']['views']['tree']['fields']['tax_line_id']['domain'] = [('tag_ids', 'in', [self.env.ref(self._context.get('vat_domain')).id])] + return res + @api.model def create(self, vals): move = super(AccountMove, self.with_context(check_move_validity=False, partner_id=vals.get('partner_id'))).create(vals) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 126e783529f..7258e087f28 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -439,6 +439,7 @@ class AccountTaxTemplate(models.Model): analytic = fields.Boolean(string="Analytic Cost", help="If set, the amount computed by this tax will be assigned to the same analytic account as the invoice line (if any)") tag_ids = fields.Many2many('account.account.tag', string='Account tag', help="Optional tags you may want to assign for custom reporting") tax_group_id = fields.Many2one('account.tax.group', string="Tax Group") + tax_adjustment = fields.Boolean(default=False) _sql_constraints = [ ('name_company_uniq', 'unique(name, company_id, type_tax_use)', 'Tax names must be unique !'), @@ -470,6 +471,7 @@ class AccountTaxTemplate(models.Model): 'include_base_amount': self.include_base_amount, 'analytic': self.analytic, 'tag_ids': [(6, 0, [t.id for t in self.tag_ids])], + 'tax_adjustment': self.tax_adjustment, } if self.tax_group_id: val['tax_group_id'] = self.tax_group_id.id diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index dea42767766..5922eb82a67 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -994,6 +994,7 @@ + diff --git a/addons/account_tax_adjustments/views/tax_adjustments.xml b/addons/account/views/tax_adjustments.xml similarity index 100% rename from addons/account_tax_adjustments/views/tax_adjustments.xml rename to addons/account/views/tax_adjustments.xml diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py index 8fe6bca9b63..502cfc0c71e 100644 --- a/addons/account/wizard/__init__.py +++ b/addons/account/wizard/__init__.py @@ -19,3 +19,4 @@ import account_report_partner_ledger import account_report_trial_balance import account_financial_report import account_report_aged_partner_balance +import wizard_tax_adjustments diff --git a/addons/account_tax_adjustments/wizard/wizard_tax_adjustments.py b/addons/account/wizard/wizard_tax_adjustments.py similarity index 94% rename from addons/account_tax_adjustments/wizard/wizard_tax_adjustments.py rename to addons/account/wizard/wizard_tax_adjustments.py index e27b995c887..fa29d0b6bcb 100644 --- a/addons/account_tax_adjustments/wizard/wizard_tax_adjustments.py +++ b/addons/account/wizard/wizard_tax_adjustments.py @@ -19,7 +19,7 @@ class TaxAdjustments(models.TransientModel): credit_account_id = fields.Many2one('account.account', string='Credit account', required=True, domain=[('deprecated', '=', False)]) amount = fields.Monetary(currency_field='company_currency_id', required=True) company_currency_id = fields.Many2one('res.currency', readonly=True, default=lambda self: self.env.user.company_id.currency_id) - tax_id = fields.Many2one('account.tax', string='Adjustment Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'none'), ('amount_type', '=', 'fixed'), ('amount', '=', 0)], required=True) + tax_id = fields.Many2one('account.tax', string='Adjustment Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'none'), ('tax_adjustment', '=', True)], required=True) @api.multi def _create_move(self): @@ -52,7 +52,7 @@ class TaxAdjustments(models.TransientModel): #create the adjustment move move_id = self._create_move() #return an action showing the created move - action = self.env.ref('account.action_move_line_form') + action = self.env.ref(self.env.context.get('action', 'account.action_move_line_form')) result = action.read()[0] result['views'] = [(False, 'form')] result['res_id'] = move_id diff --git a/addons/account_tax_adjustments/wizard/wizard_tax_adjustments_view.xml b/addons/account/wizard/wizard_tax_adjustments_view.xml similarity index 100% rename from addons/account_tax_adjustments/wizard/wizard_tax_adjustments_view.xml rename to addons/account/wizard/wizard_tax_adjustments_view.xml diff --git a/addons/account_tax_adjustments/__init__.py b/addons/account_tax_adjustments/__init__.py deleted file mode 100644 index 106dad19d23..00000000000 --- a/addons/account_tax_adjustments/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -import wizard diff --git a/addons/account_tax_adjustments/__openerp__.py b/addons/account_tax_adjustments/__openerp__.py deleted file mode 100644 index 86f24d7f2b4..00000000000 --- a/addons/account_tax_adjustments/__openerp__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -{ - 'name': 'Accounting Tax Adjustments', - 'version': '1.1', - 'category': 'Accounting & Finance', - 'description': """ -Accounting Tax Adjustments. -=========================== - -This module adds a wizard to deal with manual Tax adjustments, to manually correct the VAT declaration through a miscellaneous operation for example. - -The correct definition of an adjustment tax is -- type_tax_use: none -- amount_type: fixed -- amount: 0 -- tags: a grid used in your vat report for manual correction. - - """, - 'website': 'https://www.odoo.com/page/accounting', - 'depends': ['account'], - 'data': [ - 'views/tax_adjustments.xml', - 'wizard/wizard_tax_adjustments_view.xml', - ], - 'demo': [], - 'installable': True, - 'auto_install': False, -} diff --git a/addons/account_tax_adjustments/i18n/account_tax_adjustments.pot b/addons/account_tax_adjustments/i18n/account_tax_adjustments.pot deleted file mode 100644 index b97093a9e0d..00000000000 --- a/addons/account_tax_adjustments/i18n/account_tax_adjustments.pot +++ /dev/null @@ -1,133 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_tax_adjustments -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 9.0c\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-04-05 16:21+0000\n" -"PO-Revision-Date: 2016-04-05 16:21+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: account_tax_adjustments -#: model:ir.ui.view,arch_db:account_tax_adjustments.tax_adjustments_wizard -msgid "Accounts" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_tax_id -msgid "Adjustment Tax" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_amount -msgid "Amount" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.ui.view,arch_db:account_tax_adjustments.tax_adjustments_wizard -msgid "Cancel" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_company_currency_id -msgid "Company currency id" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.ui.view,arch_db:account_tax_adjustments.tax_adjustments_wizard -msgid "Create and post move" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_create_uid -msgid "Created by" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_create_date -msgid "Created on" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_credit_account_id -msgid "Credit account" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_date -msgid "Date" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_debit_account_id -msgid "Debit account" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_display_name -msgid "Display Name" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_id -msgid "ID" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_journal_id -msgid "Journal" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_reason -msgid "Justification" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard___last_update -msgid "Last Modified on" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_write_uid -msgid "Last Updated by" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model.fields,field_description:account_tax_adjustments.field_tax_adjustments_wizard_write_date -msgid "Last Updated on" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.ui.view,arch_db:account_tax_adjustments.tax_adjustments_wizard -msgid "Options" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model,name:account_tax_adjustments.model_account_tax -msgid "Tax" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.actions.act_window,name:account_tax_adjustments.tax_adjustments_form -#: model:ir.ui.menu,name:account_tax_adjustments.menu_action_account_form -msgid "Tax Adjustments" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.model,name:account_tax_adjustments.model_tax_adjustments_wizard -msgid "Wizard for Tax Adjustments" -msgstr "" - -#. module: account_tax_adjustments -#: model:ir.ui.view,arch_db:account_tax_adjustments.tax_adjustments_wizard -msgid "or" -msgstr "" - diff --git a/addons/account_tax_adjustments/wizard/__init__.py b/addons/account_tax_adjustments/wizard/__init__.py deleted file mode 100644 index 4a4448a2ac6..00000000000 --- a/addons/account_tax_adjustments/wizard/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -import wizard_tax_adjustments diff --git a/addons/l10n_be/account_tax_template.xml b/addons/l10n_be/account_tax_template.xml index 0785ba2269c..9a758df7404 100644 --- a/addons/l10n_be/account_tax_template.xml +++ b/addons/l10n_be/account_tax_template.xml @@ -1767,6 +1767,7 @@ 0.0 fixed none + @@ -1778,6 +1779,7 @@ 0.0 fixed none +