From 190acd9765ea509768540725c93c3fb61acbadce Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 15 Dec 2021 12:49:02 +0100 Subject: [PATCH] intrastat_base: Remove intrastat.common class --- intrastat_base/__manifest__.py | 1 - intrastat_base/models/__init__.py | 2 +- intrastat_base/models/intrastat_common.py | 216 ------------------ intrastat_base/models/res_company.py | 34 ++- intrastat_base/security/ir.model.access.csv | 2 - intrastat_base/tests/common.py | 43 ---- intrastat_base/tests/data/mail_template.xml | 59 ----- intrastat_base/tests/test_all.py | 51 +---- intrastat_base/views/intrastat.xml | 14 -- intrastat_product/__init__.py | 1 + intrastat_product/__manifest__.py | 1 + .../models/intrastat_product_declaration.py | 118 +++++++++- .../security/ir.model.access.csv | 1 + intrastat_product/tests/common.py | 1 + .../tests/test_intrastat_product.py | 24 +- intrastat_product/wizards/__init__.py | 1 + .../wizards/intrastat_result_view.py | 14 ++ .../wizards/intrastat_result_view.xml | 22 ++ 18 files changed, 214 insertions(+), 391 deletions(-) delete mode 100644 intrastat_base/models/intrastat_common.py delete mode 100644 intrastat_base/security/ir.model.access.csv delete mode 100644 intrastat_base/tests/data/mail_template.xml create mode 100644 intrastat_product/wizards/__init__.py create mode 100644 intrastat_product/wizards/intrastat_result_view.py create mode 100644 intrastat_product/wizards/intrastat_result_view.xml diff --git a/intrastat_base/__manifest__.py b/intrastat_base/__manifest__.py index e12e23d..e414249 100644 --- a/intrastat_base/__manifest__.py +++ b/intrastat_base/__manifest__.py @@ -14,7 +14,6 @@ "depends": ["base_vat", "account"], "excludes": ["account_intrastat"], "data": [ - "security/ir.model.access.csv", "views/product_template.xml", "views/res_partner.xml", "views/res_config_settings.xml", diff --git a/intrastat_base/models/__init__.py b/intrastat_base/models/__init__.py index eff3d68..cea19b9 100644 --- a/intrastat_base/models/__init__.py +++ b/intrastat_base/models/__init__.py @@ -1,5 +1,5 @@ from . import product_template from . import res_company -from . import intrastat_common from . import account_fiscal_position +from . import account_fiscal_position_template from . import account_move diff --git a/intrastat_base/models/intrastat_common.py b/intrastat_base/models/intrastat_common.py deleted file mode 100644 index 4b37057..0000000 --- a/intrastat_base/models/intrastat_common.py +++ /dev/null @@ -1,216 +0,0 @@ -# Copyright 2010-2020 Akretion () -# Copyright 2009-2020 Noviat (http://www.noviat.com) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging -from io import BytesIO -from sys import exc_info -from traceback import format_exception - -from lxml import etree - -from odoo import _, api, fields, models, tools -from odoo.exceptions import UserError, ValidationError - -logger = logging.getLogger(__name__) - - -class IntrastatCommon(models.AbstractModel): - _name = "intrastat.common" - _description = "Common functions for intrastat reports for products " - "and services" - - company_id = fields.Many2one( - comodel_name="res.company", - string="Company", - required=True, - states={"done": [("readonly", True)]}, - default=lambda self: self._default_company_id(), - ) - company_country_code = fields.Char( - compute="_compute_company_country_code", - string="Company Country Code", - readonly=True, - store=True, - help="Used in views and methods of localization modules.", - ) - state = fields.Selection( - selection=[("draft", "Draft"), ("done", "Done")], - string="State", - readonly=True, - tracking=True, - copy=False, - default="draft", - help="State of the declaration. When the state is set to 'Done', " - "the parameters become read-only.", - ) - note = fields.Text( - string="Notes", help="You can add some comments here if you want." - ) - - year = fields.Char( - string="Year", required=True, states={"done": [("readonly", True)]} - ) - month = fields.Selection( - selection=[ - ("01", "01"), - ("02", "02"), - ("03", "03"), - ("04", "04"), - ("05", "05"), - ("06", "06"), - ("07", "07"), - ("08", "08"), - ("09", "09"), - ("10", "10"), - ("11", "11"), - ("12", "12"), - ], - string="Month", - required=True, - states={"done": [("readonly", True)]}, - ) - year_month = fields.Char( - compute="_compute_year_month", - string="Period", - readonly=True, - tracking=True, - store=True, - help="Year and month of the declaration.", - ) - - @api.model - def _default_company_id(self): - return self.env.company - - @api.depends("company_id") - def _compute_company_country_code(self): - for this in self: - if this.company_id: - if not this.company_id.country_id: - raise ValidationError(_("You must set company's country !")) - this.company_country_code = this.company_id.country_id.code.lower() - - @api.depends("year", "month") - def _compute_year_month(self): - for this in self: - if this.year and this.month: - this.year_month = "-".join([this.year, this.month]) - - @api.model - @api.constrains("year") - def _check_year(self): - for this in self: - if len(this.year) != 4 or this.year[0] != "2": - raise ValidationError(_("Invalid Year !")) - - # The method _compute_numbers has been removed - # because it was using a loop on lines, which is slow -> we should - # use read_group() instead, but then the code depends on - # the line object, so it can't be factorized here - - def _check_generate_xml(self): - for this in self: - if not this.company_id.partner_id.vat: - raise UserError( - _("The VAT number is not set for the partner '%s'.") - % this.company_id.partner_id.name - ) - - @api.model - def _check_xml_schema(self, xml_bytes, xsd_file): - """Validate the XML file against the XSD""" - xsd_etree_obj = etree.parse(tools.file_open(xsd_file, mode="rb")) - official_schema = etree.XMLSchema(xsd_etree_obj) - try: - t = etree.parse(BytesIO(xml_bytes)) - official_schema.assertValid(t) - except (etree.XMLSchemaParseError, etree.DocumentInvalid) as e: - logger.warning("The XML file is invalid against the XML Schema Definition") - logger.warning(xml_bytes) - logger.warning(e) - usererror = "{}\n\n{}".format(e.__class__.__name__, str(e)) - raise UserError(usererror) - except Exception: - error = _("Unknown Error") - tb = "".join(format_exception(*exc_info())) - error += "\n%s" % tb - logger.warning(error) - raise UserError(error) - - def _attach_xml_file(self, xml_bytes, declaration_name): - """Attach the XML file to the report_intrastat_product/service - object""" - self.ensure_one() - filename = "{}_{}.xml".format(self.year_month, declaration_name) - attach = self.env["ir.attachment"].create( - { - "name": filename, - "res_id": self.id, - "res_model": self._name, - "raw": xml_bytes, - } - ) - return attach.id - - def _unlink_attachments(self): - atts = self.env["ir.attachment"].search( - [("res_model", "=", self._name), ("res_id", "=", self.id)] - ) - atts.unlink() - - # Method _open_attach_view() removed - # Let's handle attachments like in l10n_fr_intrastat_service v14 - # with the field attachment_id on the declaration and the download - # link directly on the form view of the declaration. - - def _generate_xml(self): - """ - Inherit this method in the localization module - to generate the INTRASTAT Declaration XML file - - Returns: - string with XML data - - Call the _check_xml_schema() method - before returning the XML string. - """ - return False - - def send_reminder_email(self, mail_template_xmlid): - mail_template = self.env.ref(mail_template_xmlid) - for this in self: - if this.company_id.intrastat_remind_user_ids: - mail_template.send_mail(this.id) - logger.info( - "Intrastat Reminder email has been sent (XMLID: %s)." - % mail_template_xmlid - ) - else: - logger.warning( - "The list of users receiving the Intrastat Reminder is " - "empty on company %s" % this.company_id.name - ) - return True - - def unlink(self): - for intrastat in self: - if intrastat.state == "done": - raise UserError( - _("Cannot delete the declaration %s " "because it is in Done state") - % self.year_month - ) - return super().unlink() - - -class IntrastatResultView(models.TransientModel): - """ - Transient Model to display Intrastat Report results - """ - - _name = "intrastat.result.view" - _description = "Pop-up to show errors on intrastat report generation" - - note = fields.Text( - string="Notes", readonly=True, default=lambda self: self._context.get("note") - ) diff --git a/intrastat_base/models/res_company.py b/intrastat_base/models/res_company.py index eefce32..7a2dbc9 100644 --- a/intrastat_base/models/res_company.py +++ b/intrastat_base/models/res_company.py @@ -2,8 +2,17 @@ # @author: # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models -from odoo.exceptions import ValidationError +import logging +from io import BytesIO +from sys import exc_info +from traceback import format_exception + +from lxml import etree + +from odoo import _, api, fields, models, tools +from odoo.exceptions import UserError, ValidationError + +logger = logging.getLogger(__name__) class ResCompany(models.Model): @@ -40,3 +49,24 @@ class ResCompany(models.Model): raise ValidationError( _("Missing e-mail address on user '%s'.") % (user.name) ) + + @api.model + def _intrastat_check_xml_schema(self, xml_bytes, xsd_file): + """Validate the XML file against the XSD""" + xsd_etree_obj = etree.parse(tools.file_open(xsd_file, mode="rb")) + official_schema = etree.XMLSchema(xsd_etree_obj) + try: + t = etree.parse(BytesIO(xml_bytes)) + official_schema.assertValid(t) + except (etree.XMLSchemaParseError, etree.DocumentInvalid) as e: + logger.warning("The XML file is invalid against the XML Schema Definition") + logger.warning(xml_bytes) + logger.warning(e) + usererror = "{}\n\n{}".format(e.__class__.__name__, str(e)) + raise UserError(usererror) + except Exception: + error = _("Unknown Error") + tb = "".join(format_exception(*exc_info())) + error += "\n%s" % tb + logger.warning(error) + raise UserError(error) diff --git a/intrastat_base/security/ir.model.access.csv b/intrastat_base/security/ir.model.access.csv deleted file mode 100644 index fbe710c..0000000 --- a/intrastat_base/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_intrastat_result_view,Access on intrastat.result.view,model_intrastat_result_view,account.group_account_user,1,1,1,0 diff --git a/intrastat_base/tests/common.py b/intrastat_base/tests/common.py index 58a2491..ac1fbf3 100644 --- a/intrastat_base/tests/common.py +++ b/intrastat_base/tests/common.py @@ -1,45 +1,8 @@ # Copyright 2021 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo_test_helper import FakeModelLoader - -from odoo.modules.module import get_resource_path -from odoo.tools import convert_file class IntrastatCommon(object): - @classmethod - def _load_xml(cls, module, filepath): - convert_file( - cls.env.cr, - module, - get_resource_path(module, filepath), - {}, - mode="init", - noupdate=False, - kind="test", - ) - - @classmethod - def _load_test_declaration(cls): - cls.loader = FakeModelLoader(cls.env, cls.__module__) - cls.loader.backup_registry() - - # The fake class is imported here !! After the backup_registry - from .models import IntrastatDeclarationTest - - cls.loader.update_registry((IntrastatDeclarationTest,)) - - @classmethod - def _create_declaration(cls, vals=None): - values = { - "company_id": cls.declaration_test_obj._default_company_id().id, - "year": "2021", - "month": "03", - } - if vals is not None: - values.update(vals) - cls.declaration = cls.declaration_test_obj.create(values) - @classmethod def setUpClass(cls): super().setUpClass() @@ -51,9 +14,3 @@ class IntrastatCommon(object): cls.demo_company = cls.env.ref("base.main_company") cls.shipping_cost = cls.env.ref("intrastat_base.shipping_costs_exclude") - cls._load_test_declaration() - - @classmethod - def tearDownClass(cls): - cls.loader.restore_registry() - super().tearDownClass() diff --git a/intrastat_base/tests/data/mail_template.xml b/intrastat_base/tests/data/mail_template.xml deleted file mode 100644 index b3313f2..0000000 --- a/intrastat_base/tests/data/mail_template.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Intrastat Product Reminder - - - ${object.company_id.email or 'odoo@example.com'} - ${object.company_id.intrastat_email_list} - ${object.type} DEB ${object.year_month} for ${object.company_id.name} - - - -

I would like to remind you that we are approaching the deadline for the DEB for month ${object.year_month}.

- -

As there were no ${object.type} DEB for that month in Odoo, a draft DEB has been generated automatically by Odoo.

- -% if ctx.get('exception'): -

When trying to generate the lines of the ${object.declaration_type} DEB, the following error was encountered:

- -

${ctx.get('error_msg')}

- -

You should solve this error, then go to the menu "Invoicing > Reporting > Intrastat > DEB", open the ${object.declaration_type} declaration for month ${object.year_month} and click on the button "Generate lines from invoices".

- -% else: -% if object.num_lines and object.num_lines > 0: -

This draft ${object.type} DEB contains ${object.num_decl_lines} ${object.num_decl_lines == 1 and 'line' or 'lines'}.

-% else: -

This draft ${object.type} DEB generated automatically by Odoo doesn't contain any line.

-% endif - -

Go and check this declaration in Odoo in the menu "Invoicing > Reporting > Intrastat > DEB".

- -% endif - -

--- -Automatic e-mail sent by Odoo. -

- -]]> -
-
-
diff --git a/intrastat_base/tests/test_all.py b/intrastat_base/tests/test_all.py index cc7b203..40b414f 100644 --- a/intrastat_base/tests/test_all.py +++ b/intrastat_base/tests/test_all.py @@ -1,5 +1,4 @@ -from odoo.exceptions import UserError, ValidationError -from odoo.tests.common import SavepointCase +from odoo.exceptions import ValidationError from .common import IntrastatCommon @@ -10,11 +9,6 @@ class TestIntrastatBase(IntrastatCommon): @classmethod def setUpClass(cls): super().setUpClass() - cls.declaration_test_obj = cls.env["intrastat.declaration.test"] - cls._load_xml("intrastat_base", "tests/data/mail_template.xml") - cls.mail_template_id = ( - "intrastat_base.base_intrastat_product_reminder_email_template" - ) def test_company(self): # add 'Demo user' to intrastat_remind_user_ids @@ -34,46 +28,3 @@ class TestIntrastatBase(IntrastatCommon): def test_accessory(self): with self.assertRaises(ValidationError): self.shipping_cost.type = "consu" - - def test_declaration_no_country(self): - self.demo_company.country_id = False - with self.assertRaises(ValidationError): - self._create_declaration() - self.declaration.flush() - - def test_declaration_no_vat(self): - self.demo_company.partner_id.vat = False - with self.assertRaises(UserError): - self._create_declaration() - self.declaration.flush() - self.declaration._check_generate_xml() - - def test_declaration_send_mail(self): - self._create_declaration() - mail_before = self.mail_obj.search([]) - self.declaration.send_reminder_email(self.mail_template_id) - mail_after = self.mail_obj.search([]) - mail_before - self.assertEqual(0, len(mail_after)) - self.demo_company.write( - {"intrastat_remind_user_ids": [(6, False, [self.demo_user.id])]} - ) - self.declaration.send_reminder_email(self.mail_template_id) - mail_after = self.mail_obj.search([]) - mail_before - self.assertEqual(1, len(mail_after)) - self.assertIn( - mail_after.email_to, - self.demo_user.email, - ) - - def test_declaration_state(self): - self._create_declaration() - self.declaration.unlink() - - self._create_declaration() - self.declaration.state = "done" - with self.assertRaises(UserError): - self.declaration.unlink() - - -class TestIntrastat(TestIntrastatBase, SavepointCase): - """ Test Intrastat """ diff --git a/intrastat_base/views/intrastat.xml b/intrastat_base/views/intrastat.xml index ca14bae..4784270 100644 --- a/intrastat_base/views/intrastat.xml +++ b/intrastat_base/views/intrastat.xml @@ -18,18 +18,4 @@ parent="account.menu_finance_configuration" sequence="50" /> - - intrastat.result_view_form - intrastat.result.view - -
- - - -
-
-
-
-
diff --git a/intrastat_product/__init__.py b/intrastat_product/__init__.py index bf588bc..cf6083c 100644 --- a/intrastat_product/__init__.py +++ b/intrastat_product/__init__.py @@ -1,2 +1,3 @@ from . import models from . import report +from . import wizards diff --git a/intrastat_product/__manifest__.py b/intrastat_product/__manifest__.py index 10753dd..cc9f6c4 100644 --- a/intrastat_product/__manifest__.py +++ b/intrastat_product/__manifest__.py @@ -35,6 +35,7 @@ "views/account_move.xml", "views/sale_order.xml", "views/stock_warehouse.xml", + "wizards/intrastat_result_view.xml", "data/intrastat_transport_mode.xml", "data/intrastat_unit.xml", ], diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index d7e3c42..4b404b4 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -20,7 +20,7 @@ class IntrastatProductDeclaration(models.Model): _name = "intrastat.product.declaration" _description = "Intrastat Product Report Base Object" _rec_name = "year_month" - _inherit = ["mail.thread", "mail.activity.mixin", "intrastat.common"] + _inherit = ["mail.thread", "mail.activity.mixin"] _order = "year_month desc, declaration_type, revision" _sql_constraints = [ ( @@ -41,6 +41,62 @@ class IntrastatProductDeclaration(models.Model): ) return res + company_id = fields.Many2one( + comodel_name="res.company", + string="Company", + required=True, + states={"done": [("readonly", True)]}, + default=lambda self: self.env.company, + ) + company_country_code = fields.Char( + compute="_compute_company_country_code", + string="Company Country Code", + readonly=True, + store=True, + ) + state = fields.Selection( + selection=[("draft", "Draft"), ("done", "Done")], + string="State", + readonly=True, + tracking=True, + copy=False, + default="draft", + help="State of the declaration. When the state is set to 'Done', " + "the parameters become read-only.", + ) + note = fields.Text( + string="Notes", help="You can add some comments here if you want." + ) + year = fields.Char( + string="Year", required=True, states={"done": [("readonly", True)]} + ) + month = fields.Selection( + selection=[ + ("01", "01"), + ("02", "02"), + ("03", "03"), + ("04", "04"), + ("05", "05"), + ("06", "06"), + ("07", "07"), + ("08", "08"), + ("09", "09"), + ("10", "10"), + ("11", "11"), + ("12", "12"), + ], + string="Month", + required=True, + states={"done": [("readonly", True)]}, + ) + year_month = fields.Char( + compute="_compute_year_month", + string="Period", + readonly=True, + tracking=True, + store=True, + help="Year and month of the declaration.", + ) declaration_type = fields.Selection( selection="_get_declaration_type", string="Type", @@ -127,12 +183,32 @@ class IntrastatProductDeclaration(models.Model): ("nihil", _("Nihil")), ] + @api.depends("company_id") + def _compute_company_country_code(self): + for this in self: + if this.company_id: + if not this.company_id.country_id: + raise ValidationError(_("You must set company's country !")) + this.company_country_code = this.company_id.country_id.code.lower() + + @api.depends("year", "month") + def _compute_year_month(self): + for this in self: + if this.year and this.month: + this.year_month = "-".join([this.year, this.month]) + @api.depends("month") def _compute_check_validity(self): """ TO DO: logic based upon computation lines """ for this in self: this.valid = True + @api.constrains("year") + def _check_year(self): + for this in self: + if len(this.year) != 4 or this.year[0] != "2": + raise ValidationError(_("Invalid Year!")) + @api.onchange("declaration_type") def _onchange_declaration_type(self): if self.declaration_type == "arrivals": @@ -160,6 +236,36 @@ class IntrastatProductDeclaration(models.Model): msg, action.id, _("Go to Accounting Configuration Settings screen") ) + def _attach_xml_file(self, xml_bytes, declaration_name): + """Attach the XML file to the report_intrastat_product/service + object""" + self.ensure_one() + filename = "{}_{}.xml".format(self.year_month, declaration_name) + attach = self.env["ir.attachment"].create( + { + "name": filename, + "res_id": self.id, + "res_model": self._name, + "raw": xml_bytes, + } + ) + return attach.id + + def _unlink_attachments(self): + atts = self.env["ir.attachment"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)] + ) + atts.unlink() + + def unlink(self): + for this in self: + if this.state == "done": + raise UserError( + _("Cannot delete the declaration %s because it is in Done state.") + % this.display_name + ) + return super().unlink() + def _get_partner_country(self, inv_line, notedict, eu_countries): inv = inv_line.move_id country = inv.src_dest_country_id or inv.partner_id.country_id @@ -712,7 +818,7 @@ class IntrastatProductDeclaration(models.Model): self.write(vals) if vals["note"]: - result_view = self.env.ref("intrastat_base.intrastat_result_view_form") + result_view = self.env.ref("intrastat_product.intrastat_result_view_form") return { "name": _("Generate lines from invoices: results"), "view_type": "form", @@ -809,6 +915,14 @@ class IntrastatProductDeclaration(models.Model): cl.write({"declaration_line_id": declaration_line.id}) return True + def _check_generate_xml(self): + self.ensure_one() + if not self.company_id.partner_id.vat: + raise UserError( + _("The VAT number is not set for the partner '%s'.") + % self.company_id.partner_id.display_name + ) + def generate_xml(self): """ generate the INTRASTAT Declaration XML file """ self.ensure_one() diff --git a/intrastat_product/security/ir.model.access.csv b/intrastat_product/security/ir.model.access.csv index ac93450..65141ca 100644 --- a/intrastat_product/security/ir.model.access.csv +++ b/intrastat_product/security/ir.model.access.csv @@ -12,3 +12,4 @@ access_account_move_intrastat_line,Full access on Invoice Intrastat Lines,model_ access_intrastat_product_declaration,Full access on Intrastat Product Declarations to Accountant,model_intrastat_product_declaration,account.group_account_user,1,1,1,1 access_intrastat_product_computation_line,Full access on Intrastat Product Computation Lines to Accountant,model_intrastat_product_computation_line,account.group_account_user,1,1,1,1 access_intrastat_product_declaration_line,Full access on Intrastat Product Declaration Lines to Accountant,model_intrastat_product_declaration_line,account.group_account_user,1,1,1,1 +access_intrastat_result_view,Access on intrastat.result.view,model_intrastat_result_view,account.group_account_user,1,1,1,0 diff --git a/intrastat_product/tests/common.py b/intrastat_product/tests/common.py index fbe94d1..6efb68b 100644 --- a/intrastat_product/tests/common.py +++ b/intrastat_product/tests/common.py @@ -107,6 +107,7 @@ class IntrastatProductCommon(IntrastatCommon): def _create_declaration(cls, vals=None): values = { "company_id": cls.env.company.id, + "declaration_type": "dispatches", } if vals is not None: values.update(vals) diff --git a/intrastat_product/tests/test_intrastat_product.py b/intrastat_product/tests/test_intrastat_product.py index 8a6b138..dd1f095 100644 --- a/intrastat_product/tests/test_intrastat_product.py +++ b/intrastat_product/tests/test_intrastat_product.py @@ -4,7 +4,7 @@ from psycopg2 import IntegrityError from odoo.tests.common import SavepointCase from odoo.tools import mute_logger - +from odoo.exceptions import UserError, ValidationError from .common import IntrastatProductCommon @@ -39,6 +39,28 @@ class TestIntrastatProduct(IntrastatProductCommon): decl_copy = self.declaration.copy() self.assertEqual(self.declaration.revision + 1, decl_copy.revision) + def test_declaration_no_country(self): + self.demo_company.country_id = False + with self.assertRaises(ValidationError): + self._create_declaration() + self.declaration.flush() + + def test_declaration_no_vat(self): + self.demo_company.partner_id.vat = False + with self.assertRaises(UserError): + self._create_declaration() + self.declaration.flush() + self.declaration._check_generate_xml() + + def test_declaration_state(self): + self._create_declaration() + self.declaration.unlink() + + self._create_declaration() + self.declaration.state = "done" + with self.assertRaises(UserError): + self.declaration.unlink() + class TestIntrastatProductCase(TestIntrastatProduct, SavepointCase): """ Test Intrastat Product """ diff --git a/intrastat_product/wizards/__init__.py b/intrastat_product/wizards/__init__.py new file mode 100644 index 0000000..3277b28 --- /dev/null +++ b/intrastat_product/wizards/__init__.py @@ -0,0 +1 @@ +from . import intrastat_result_view diff --git a/intrastat_product/wizards/intrastat_result_view.py b/intrastat_product/wizards/intrastat_result_view.py new file mode 100644 index 0000000..efd743f --- /dev/null +++ b/intrastat_product/wizards/intrastat_result_view.py @@ -0,0 +1,14 @@ +# Copyright 2010-2021 Akretion () +# Copyright 2009-2021 Noviat (http://www.noviat.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class IntrastatResultView(models.TransientModel): + _name = "intrastat.result.view" + _description = "Pop-up to show errors on intrastat report generation" + + note = fields.Text( + string="Notes", readonly=True, default=lambda self: self._context.get("note") + ) diff --git a/intrastat_product/wizards/intrastat_result_view.xml b/intrastat_product/wizards/intrastat_result_view.xml new file mode 100644 index 0000000..16b9303 --- /dev/null +++ b/intrastat_product/wizards/intrastat_result_view.xml @@ -0,0 +1,22 @@ + + + + + intrastat.result_view_form + intrastat.result.view + +
+ + + + +
+
+
+