[MERGE] account: merge of account_tax_adjustment module as a core feature of account module. Added a boolean 'tax adjustment' on account.tax to define taxes that can be used in the wizard instead of taxes with fixed amount of 0
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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.")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -994,6 +994,7 @@
|
||||
<group name="advanced_booleans">
|
||||
<field name="price_include" attrs="{'invisible':[('amount_type','=', 'group')]}" />
|
||||
<field name="include_base_amount" attrs="{'invisible':[('amount_type','=', 'group')]}" />
|
||||
<field name="tax_adjustment"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import wizard
|
||||
@@ -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,
|
||||
}
|
||||
@@ -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 ""
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import wizard_tax_adjustments
|
||||
@@ -1767,6 +1767,7 @@
|
||||
<field name="amount">0.0</field>
|
||||
<field name="amount_type">fixed</field>
|
||||
<field name="type_tax_use">none</field>
|
||||
<field name="tax_adjustment" eval="True"/>
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_61')])]"/>
|
||||
</record>
|
||||
@@ -1778,6 +1779,7 @@
|
||||
<field name="amount">0.0</field>
|
||||
<field name="amount_type">fixed</field>
|
||||
<field name="type_tax_use">none</field>
|
||||
<field name="tax_adjustment" eval="True"/>
|
||||
<field name="chart_template_id" ref="l10nbe_chart_template"/>
|
||||
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_62')])]"/>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user