[MIG] intrastat_base to v16

This commit is contained in:
Alexis de Lattre
2022-12-27 22:38:02 +01:00
parent 7375e6b33c
commit 19f9dd43c3
16 changed files with 86 additions and 98 deletions

View File

@@ -1,11 +1,11 @@
# Copyright 2011-2021 Akretion (http://www.akretion.com)
# Copyright 2018-2021 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# Copyright 2009-2021 Noviat (http://www.noviat.com)
# Copyright 2011-2022 Akretion (http://www.akretion.com)
# Copyright 2018-2022 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# Copyright 2009-2022 Noviat (http://www.noviat.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Intrastat Reporting Base",
"version": "15.0.1.0.1",
"version": "16.0.1.0.0",
"category": "Intrastat",
"license": "AGPL-3",
"summary": "Base module for Intrastat reporting",

View File

@@ -1,22 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2011-2021 Akretion France (http://www.akretion.com/)
Copyright 2011-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="base.main_company" model="res.company">
<field
name="intrastat_remind_user_ids"
eval="[(4, ref('base.user_demo')), (4, ref('base.user_admin'))]"
/>
</record>
<record id="base.main_partner" model="res.partner">
<field name="vat">FR58441019213</field>
</record>
<record id="base.res_partner_2" model="res.partner">
<!-- Deco Addict -->
<field name="vat">BE0884025633</field>
<!-- Create a few partners from several EU countries
with real/valid VAT number -->
<record id="noviat" model="res.partner">
<field name="name">Noviat</field>
<field name="is_company">1</field>
<field name="website">https://www.noviat.com</field>
<field name="street">Avenue de Rusatiralaan 1</field>
<field name="city">Ganshoren</field>
<field name="zip">1083</field>
<field name="country_id" ref="base.be" />
<field name="vat">BE0820512013</field>
</record>
<record id="acsone" model="res.partner">
<field name="name">Acsone</field>
<field name="is_company">1</field>
<field name="website">https://www.acsone.eu</field>
<field name="street">Drève Richelle, 167</field>
<field name="city">Waterloo</field>
<field name="zip">1410</field>
<field name="country_id" ref="base.be" />
<field name="vat">BE0835207216</field>
</record>
<record id="tecnativa" model="res.partner">
<field name="name">Tecnativa</field>
<field name="is_company">1</field>
<field name="website">https://www.tecnativa.com</field>
<field name="street">Calle Tormos 1-A, 25</field>
<field name="city">Alicante</field>
<field name="zip">03008</field>
<field name="country_id" ref="base.es" />
<field name="vat">ESB87530432</field>
</record>
<record id="forgeflow" model="res.partner">
<field name="name">ForgeFlow</field>
<field name="is_company">1</field>
<field name="website">https://www.forgeflow.com</field>
<field name="street">Rosselló 319, 6-1</field>
<field name="city">Barcelona</field>
<field name="zip">08037</field>
<field name="country_id" ref="base.es" />
<field name="vat">ESB66676008</field>
</record>
<record id="akretion_france" model="res.partner">
<field name="name">Akretion France</field>
<field name="is_company">1</field>
<field name="website">https://www.akretion.com</field>
<field name="street">27 rue Henri Rolland</field>
<field name="city">Villeurbanne</field>
<field name="zip">69100</field>
<field name="country_id" ref="base.fr" />
<field name="vat">FR86792377731</field>
</record>
<record id="shipping_costs_exclude" model="product.product">
<field name="name">Shipping costs</field>

View File

@@ -3,4 +3,3 @@ from . import res_company
from . import account_fiscal_position
from . import account_fiscal_position_template
from . import account_move
from . import res_partner

View File

@@ -1,4 +1,4 @@
# Copyright 2020-2021 Akretion France (http://www.akretion.com/)
# Copyright 2020-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2020-2021 Akretion France (http://www.akretion.com/)
# Copyright 2020-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2020 Akretion France (http://www.akretion.com/)
# Copyright 2020-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models

View File

@@ -1,4 +1,4 @@
# Copyright 2020-2021 Akretion France (http://www.akretion.com/)
# Copyright 2020-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2010-2021 Akretion France (http://www.akretion.com/)
# Copyright 2010-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2013-2021 Akretion France (http://www.akretion.com/)
# Copyright 2013-2022 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,67 +0,0 @@
# Copyright 2022 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, models
from odoo.exceptions import UserError
XI_COUNTY_NAMES = [
"antrim",
"armagh",
"down",
"fermanagh",
"londonderry",
"tyrone",
"northern ireland",
]
XI_COUNTIES = [
"base.state_uk18", # County Antrim
"base.state_uk19", # County Armagh
"base.state_uk20", # County Down
"base.state_uk22", # County Fermanagh
"base.state_uk23", # County Londonderry
"base.state_uk24", # County Tyrone
"base.state_ie_27", # Antrim
"base.state_ie_28", # Armagh
"base.state_ie_29", # Down
"base.state_ie_30", # Fermanagh
"base.state_ie_31", # Londonderry
"base.state_ie_32", # Tyrone
]
class ResPartner(models.Model):
_inherit = "res.partner"
@api.model
def _get_xi_counties(self):
return [self.env.ref(x) for x in XI_COUNTIES]
@api.model
def _get_xu_counties(self):
uk_counties = self.env.ref("base.uk").state_ids
xu_counties = uk_counties.filtered(lambda r: r not in self._get_xi_counties())
return xu_counties
def _get_intrastat_country_code(self, country=None, state=None):
if self:
self.ensure_one()
country = self.country_id
state = self.state_id
else:
state = state or self.env["res.country.state"]
country = country or state.country_id
if not country:
raise UserError(
_("Programming Error when calling '_get_intrastat_country_code()")
)
cc = country.code
if cc == "GB":
cc = "XU"
if state and cc in ["XU", "IE"]:
if (
state in self._get_xi_counties()
or state.name.lower().strip() in XI_COUNTY_NAMES
):
cc = "XI"
return cc

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2020-2021 Akretion France (https://akretion.com/)
Copyright 2020-2022 Akretion France (https://akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -25,4 +25,18 @@
</field>
</field>
</record>
<record id="view_account_position_filter" model="ir.ui.view">
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_filter" />
<field name="arch" type="xml">
<field name="name" position="after">
<filter
name="intrastat"
domain="[('intrastat', '=', True)]"
string="Intrastat"
/>
<separator />
</field>
</field>
</record>
</odoo>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2011-2021 Akretion France (http://www.akretion.com/)
Copyright 2015-2021 Noviat (http://www.noviat.com/)
Copyright 2011-2022 Akretion France (http://www.akretion.com/)
Copyright 2015-2022 Noviat (http://www.noviat.com/)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2021 Akretion France (http://www.akretion.com/)
Copyright 2010-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2013-2021 Akretion France (http://www.akretion.com/)
Copyright 2013-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
Copyright 2018-2021 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
Copyright 2018-2022 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
@@ -11,7 +11,7 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='analytic']" position="after">
<xpath expr="//div[@id='storno']" position="after">
<h2>Intrastat</h2>
<div class="row mt16 o_settings_container" id="intrastat">
<div class="col-12 col-lg-12 o_setting_box" id="intrastat-settings">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2021 Akretion France (http://www.akretion.com/)
Copyright 2010-2022 Akretion France (http://www.akretion.com/)
@author David BEAL <david.beal@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -1,5 +1,5 @@
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
# Copyright 2018-2021 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# Copyright 2017-2022 Akretion France (http://www.akretion.com/)
# Copyright 2018-2022 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).