diff --git a/intrastat_base/__init__.py b/intrastat_base/__init__.py index 0650744..aee8895 100644 --- a/intrastat_base/__init__.py +++ b/intrastat_base/__init__.py @@ -1 +1,2 @@ from . import models +from . import wizards diff --git a/intrastat_base/__manifest__.py b/intrastat_base/__manifest__.py index 84fb29b..c66fb40 100644 --- a/intrastat_base/__manifest__.py +++ b/intrastat_base/__manifest__.py @@ -19,9 +19,9 @@ "views/product_template.xml", "views/res_partner.xml", "views/res_country.xml", - "views/account_tax.xml", "views/res_config_settings.xml", "views/intrastat.xml", + "views/account_fiscal_position.xml", ], "demo": ["demo/intrastat_demo.xml"], "installable": True, diff --git a/intrastat_base/models/__init__.py b/intrastat_base/models/__init__.py index 68e2955..9d1273d 100644 --- a/intrastat_base/models/__init__.py +++ b/intrastat_base/models/__init__.py @@ -1,6 +1,5 @@ from . import res_country from . import product_template -from . import account_tax from . import res_company -from . import res_config_settings from . import intrastat_common +from . import account_fiscal_position diff --git a/intrastat_base/models/account_fiscal_position.py b/intrastat_base/models/account_fiscal_position.py new file mode 100644 index 0000000..baacbdd --- /dev/null +++ b/intrastat_base/models/account_fiscal_position.py @@ -0,0 +1,30 @@ +# Copyright 2020 Akretion France (http://www.akretion.com/) +# @author: +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountFiscalPosition(models.Model): + _inherit = "account.fiscal.position" + + intrastat = fields.Boolean( + string="Intrastat", + help="Set to True if the invoices with this fiscal position should " + "be taken into account for the generation of the intrastat reports." + ) + + +class AccountFiscalPositionTemplate(models.Model): + _inherit = "account.fiscal.position.template" + + intrastat = fields.Boolean(string="Intrastat") + + +class AccountChartTemplate(models.Model): + _inherit = "account.chart.template" + + def _get_fp_vals(self, company, position): + vals = super()._get_fp_vals(company, position) + vals['intrastat'] = position.intrastat + return vals diff --git a/intrastat_base/models/account_tax.py b/intrastat_base/models/account_tax.py deleted file mode 100644 index ebe693b..0000000 --- a/intrastat_base/models/account_tax.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2011-2020 Akretion France (http://www.akretion.com). -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class AccountTax(models.Model): - _inherit = "account.tax" - - exclude_from_intrastat_if_present = fields.Boolean( - string="Exclude invoice line from intrastat if this tax is present", - help="If this tax is present on an invoice line, this invoice " - "line will be skipped when generating Intrastat Product or " - "Service lines from invoices.", - ) - - -class AccountTaxTemplate(models.Model): - _inherit = "account.tax.template" - - exclude_from_intrastat_if_present = fields.Boolean( - string="Exclude invoice line from intrastat if this tax is present", - help="If this tax is present on an invoice line, this invoice " - "line will be skipped when generating Intrastat Product or " - "Service lines from invoices.", - ) diff --git a/intrastat_base/views/account_fiscal_position.xml b/intrastat_base/views/account_fiscal_position.xml new file mode 100644 index 0000000..1a4edec --- /dev/null +++ b/intrastat_base/views/account_fiscal_position.xml @@ -0,0 +1,28 @@ + + + + + intrastat.account.fiscal.position.form + account.fiscal.position + + + + + + + + + intrastat.account.fiscal.position.tree + account.fiscal.position + + + + + + + + diff --git a/intrastat_base/views/account_tax.xml b/intrastat_base/views/account_tax.xml deleted file mode 100644 index a135bb5..0000000 --- a/intrastat_base/views/account_tax.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - intrastat.base.tax - account.tax - - - - - - - - diff --git a/intrastat_base/views/res_config_settings.xml b/intrastat_base/views/res_config_settings.xml index 934dfd7..04c4b97 100644 --- a/intrastat_base/views/res_config_settings.xml +++ b/intrastat_base/views/res_config_settings.xml @@ -14,13 +14,13 @@

Intrastat

-
+