From 5a4f6876cc2cdaad7738307634489fd9278aef4e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 22 Jan 2021 18:01:18 +0100 Subject: [PATCH] Remove intrastat from res.country Remove useless code from intrastat.common --- intrastat_base/__manifest__.py | 2 - intrastat_base/data/country_data.xml | 87 ----------------------- intrastat_base/models/__init__.py | 1 - intrastat_base/models/account_move.py | 6 +- intrastat_base/models/intrastat_common.py | 13 ---- intrastat_base/models/res_country.py | 13 ---- intrastat_base/tests/test_all.py | 9 +-- intrastat_base/views/res_country.xml | 57 --------------- 8 files changed, 5 insertions(+), 183 deletions(-) delete mode 100644 intrastat_base/data/country_data.xml delete mode 100644 intrastat_base/models/res_country.py delete mode 100644 intrastat_base/views/res_country.xml diff --git a/intrastat_base/__manifest__.py b/intrastat_base/__manifest__.py index c66fb40..61b342f 100644 --- a/intrastat_base/__manifest__.py +++ b/intrastat_base/__manifest__.py @@ -15,10 +15,8 @@ "excludes": ["account_intrastat"], "data": [ "security/ir.model.access.csv", - "data/country_data.xml", "views/product_template.xml", "views/res_partner.xml", - "views/res_country.xml", "views/res_config_settings.xml", "views/intrastat.xml", "views/account_fiscal_position.xml", diff --git a/intrastat_base/data/country_data.xml b/intrastat_base/data/country_data.xml deleted file mode 100644 index cb950e6..0000000 --- a/intrastat_base/data/country_data.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/intrastat_base/models/__init__.py b/intrastat_base/models/__init__.py index 073fa97..eff3d68 100644 --- a/intrastat_base/models/__init__.py +++ b/intrastat_base/models/__init__.py @@ -1,4 +1,3 @@ -from . import res_country from . import product_template from . import res_company from . import intrastat_common diff --git a/intrastat_base/models/account_move.py b/intrastat_base/models/account_move.py index eef7d73..4ad7eb7 100644 --- a/intrastat_base/models/account_move.py +++ b/intrastat_base/models/account_move.py @@ -9,5 +9,7 @@ class AccountMove(models.Model): _inherit = "account.move" intrastat_fiscal_position = fields.Boolean( - related="fiscal_position_id.intrastat", store=True, - string="Intrastat Fiscal Position") + related="fiscal_position_id.intrastat", + store=True, + string="Intrastat Fiscal Position", + ) diff --git a/intrastat_base/models/intrastat_common.py b/intrastat_base/models/intrastat_common.py index abac2ec..94dc5a0 100644 --- a/intrastat_base/models/intrastat_common.py +++ b/intrastat_base/models/intrastat_common.py @@ -25,18 +25,6 @@ class IntrastatCommon(models.AbstractModel): # use read_group() instead, but then the code depends on # the line object, so it can't be factorized here - def _check_generate_lines(self): - """Check wether all requirements are met for generating lines.""" - for this in self: - if not this.company_id: - raise UserError(_("Company not yet set on intrastat report.")) - company = this.company_id - if not company.country_id: - raise UserError( - _("The country is not set on the company '%s'.") % company.name - ) - return True - def _check_generate_xml(self): for this in self: if not this.company_id.partner_id.vat: @@ -44,7 +32,6 @@ class IntrastatCommon(models.AbstractModel): _("The VAT number is not set for the partner '%s'.") % this.company_id.partner_id.name ) - return True @api.model def _check_xml_schema(self, xml_bytes, xsd_file): diff --git a/intrastat_base/models/res_country.py b/intrastat_base/models/res_country.py deleted file mode 100644 index 10743b7..0000000 --- a/intrastat_base/models/res_country.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2011-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 ResCountry(models.Model): - _inherit = "res.country" - - intrastat = fields.Boolean( - string="EU Country", help="Set to True for all European Union countries." - ) diff --git a/intrastat_base/tests/test_all.py b/intrastat_base/tests/test_all.py index 62b1787..f05fc49 100644 --- a/intrastat_base/tests/test_all.py +++ b/intrastat_base/tests/test_all.py @@ -4,14 +4,7 @@ from odoo.tests.common import TransactionCase class TestIntrastatBase(TransactionCase): """Tests for this module""" - def test_10_countries(self): - # check if only EU countries have the 'intrastat' bit set - france = self.env.ref("base.fr") - self.assertTrue(france.intrastat) - brazil = self.env.ref("base.br") - self.assertFalse(brazil.intrastat) - - def test_20_company(self): + def test_company(self): # add 'Demo user' to intrastat_remind_user_ids demo_user = self.env.ref("base.user_demo") demo_company = self.env.ref("base.main_company") diff --git a/intrastat_base/views/res_country.xml b/intrastat_base/views/res_country.xml deleted file mode 100644 index 5ce3edb..0000000 --- a/intrastat_base/views/res_country.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - intrastat.base.country.tree - res.country - - - - - - - - - intrastat.base.country.form - res.country - - - - - - - - - - intrastat.base.country.search - res.country - - - - - - - - - - - - -