Merge PR #120 into 14.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2021-02-16 14:32:44 +00:00
46 changed files with 6870 additions and 0 deletions

View File

@@ -0,0 +1,156 @@
=================
Intrastat Product
=================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github
:target: https://github.com/OCA/intrastat-extrastat/tree/14.0/intrastat_product
:alt: OCA/intrastat-extrastat
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-14-0/intrastat-extrastat-14-0-intrastat_product
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/227/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module contains common objects and fields for the Intrastat Product reporting.
It should be used in combination with country-specific Intrastat Product reporting modules
such as:
- *l10n_fr_intrastat_product*:
the module for the *Déclaration d'Echange de Biens* (DEB) for France
- *l10n_be_intrastat_product*:
the module for the Intrastat Product Declaration for Belgium
These country-specific modules can be found in the OCA localization for those countries.
**Table of contents**
.. contents::
:local:
Installation
============
This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.
Configuration
=============
By default the intrastat declaration is generated based upon the product record master data.
Hence unexpected results may occur in case this master data is not accurate,
e.g. wrong or missing weight, country of origin, ...
|
This can be corrected by changing the appropriate fields when analysing the intrastat declaration
but this can be challenging in case of large transaction volumes and especially in the specific use
case where the product weight cannot be encoded correctly on the product records (e.g. products with variable weight).
|
It is possible to allow encoding the intrastat transaction details on the purchase/sale invoice
via the "intrastat_product.group_invoice_intrastat_transaction_detail" usability group.
Usage
=====
This module is used in combination with the country-specific
localization module(s).
**Coding guidelines for localization module:**
We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product
and adapt the code for the specific needs of your country.
* Declaration Object
Create a new class as follows:
.. code-block:: python
class L10nCcIntrastatProductDeclaration(models.Model):
_name = 'l10n.cc.intrastat.product.declaration'
_description = "Intrastat Product Declaration for YourCountry"
_inherit = ['intrastat.product.declaration', 'mail.thread']
whereby cc = your country code
* Computation & Declaration Lines
Create also new objects inheriting from the Computation and Declaration Line Objects
so that you can add methods or customise the methods from the base modules (make a PR when
the customization or new method is required for multiple countries).
Adapt also the parent_id fields of the newly created objects
(cf. l10n_be_intrastat_product as example).
* XML Files: Menu, Action, Views
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.
Known issues / Roadmap
======================
The declaration is based upon the invoices of the corresponding tax declaration period.
An option to generate the intrastat declaration based upon the dates of the physical movements of goods is currently not available.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/intrastat-extrastat/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* brain-tec AG
* Akretion
* Noviat
Contributors
~~~~~~~~~~~~
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
* Luc De Meyer, Noviat <info@noviat.com>
* Tecnativa <www.tecnativa.com>:
* João Marques
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/14.0/intrastat_product>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,2 @@
from . import models
from . import report

View File

@@ -0,0 +1,43 @@
# Copyright 2011-2020 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# Copyright 2018-2020 brain-tec AG (http://www.braintec-group.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
# @author Kumar Aberer <kumar.aberer@braintec-group.com>
{
"name": "Intrastat Product",
"version": "14.0.1.0.0",
"category": "Intrastat",
"license": "AGPL-3",
"summary": "Base module for Intrastat Product",
"author": "brain-tec AG, Akretion, Noviat, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/intrastat-extrastat",
"depends": [
"intrastat_base",
"product_harmonized_system",
"sale_stock",
"purchase_stock",
"report_xlsx_helper",
],
"excludes": ["account_intrastat"],
"external_dependencies": {"python": ["python-stdnum>=1.16"]},
"data": [
"security/intrastat_security.xml",
"security/ir.model.access.csv",
"views/hs_code.xml",
"views/intrastat_region.xml",
"views/intrastat_unit.xml",
"views/intrastat_transaction.xml",
"views/intrastat_transport_mode.xml",
"views/intrastat_product_declaration.xml",
"views/res_config_settings.xml",
"views/account_move.xml",
"views/sale_order.xml",
"views/stock_warehouse.xml",
"data/intrastat_transport_mode.xml",
"data/intrastat_unit.xml",
],
"demo": ["demo/intrastat_demo.xml"],
"installable": True,
}

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="intrastat_transport_1" model="intrastat.transport_mode">
<field name="code">1</field>
<field name="name">Sea</field>
<field
name="description"
>Sea Transport (including wagons, motor vehicles, trailers, semi-trailers and lighters on board of a ship)</field>
</record>
<record id="intrastat_transport_2" model="intrastat.transport_mode">
<field name="code">2</field>
<field name="name">Rail</field>
<field
name="description"
>Railway transport (including lorries on railway wagons)</field>
</record>
<record id="intrastat_transport_3" model="intrastat.transport_mode">
<field name="code">3</field>
<field name="name">Road</field>
<field name="description">Road Transport</field>
</record>
<record id="intrastat_transport_4" model="intrastat.transport_mode">
<field name="code">4</field>
<field name="name">Air</field>
<field name="description">Air Transport</field>
</record>
<record id="intrastat_transport_5" model="intrastat.transport_mode">
<field name="code">5</field>
<field name="name">Post</field>
<field name="description">Postal consignments</field>
</record>
<record id="intrastat_transport_7" model="intrastat.transport_mode">
<field name="code">7</field>
<field name="name">Fixed installations</field>
<field
name="description"
>Fixed transport installations (e.g. pipelines, high-tension cables)</field>
</record>
<record id="intrastat_transport_8" model="intrastat.transport_mode">
<field name="code">8</field>
<field name="name">Inland waterway</field>
<field name="description">Inland waterway transport</field>
</record>
<record id="intrastat_transport_9" model="intrastat.transport_mode">
<field name="code">9</field>
<field name="name">Own propulsion</field>
<field
name="description"
>Own propulsion (imported or exported means of transport crossing the border under their own power, e.g. aircraft, lorries, boats, etc.)</field>
</record>
<!-- Set default value to Road trp on main company -->
<record id="base.main_company" model="res.company">
<field name="intrastat_transport_id" ref="intrastat_transport_3" />
</record>
</odoo>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Extracted from the Official Journal of the European Union -->
<record id="intrastat_unit_c_k" model="intrastat.unit">
<field name="name">c/k</field>
<field name="description">Carats - 1 metric carat = 2 × 10exp(4) kg</field>
</record>
<record id="intrastat_unit_ce_el" model="intrastat.unit">
<field name="name">ce/el</field>
<field name="description">Number of cells</field>
</record>
<record id="intrastat_unit_ct_l" model="intrastat.unit">
<field name="name">ct/l</field>
<field name="description">Carrying capacity in tonnes</field>
</record>
<record id="intrastat_unit_g" model="intrastat.unit">
<field name="name">g</field>
<field name="description">Gram</field>
<field name="uom_id" ref="uom.product_uom_gram" />
</record>
<record id="intrastat_unit_gi_FS" model="intrastat.unit">
<field name="name">gi F/S</field>
<field name="description">Gram of fissile isotopes</field>
</record>
<record id="intrastat_unit_kg_H2O2" model="intrastat.unit">
<field name="name">kg H2O2</field>
<field name="description">Kilogram of hydrogen peroxide</field>
</record>
<record id="intrastat_unit_kg_K2O" model="intrastat.unit">
<field name="name">kg K2O</field>
<field name="description">Kilogram of potassium oxide</field>
</record>
<record id="intrastat_unit_kg_KOH" model="intrastat.unit">
<field name="name">kg KOH</field>
<field
name="description"
>Kilogram of potassium hydroxide (caustic potash)</field>
</record>
<record id="intrastat_unit_kg_ma" model="intrastat.unit">
<field name="name">kg met.am.</field>
<field name="description">Kilogram of methylamines</field>
</record>
<record id="intrastat_unit_kg_N" model="intrastat.unit">
<field name="name">kg N</field>
<field name="description">Kilogram of nitrogen</field>
</record>
<record id="intrastat_unit_kg_NaOH" model="intrastat.unit">
<field name="name">kg NaOH</field>
<field name="description">Kilogram of sodium hydroxide (caustic soda)</field>
</record>
<record id="intrastat_unit_kg_net_eda" model="intrastat.unit">
<field name="name">kg/net eda</field>
<field name="description">Kilogram drained net weight</field>
</record>
<record id="intrastat_unit_kg_P2O5" model="intrastat.unit">
<field name="name">kg P2O5</field>
<field name="description">Kilogram of diphosphorus pentaoxide</field>
</record>
<record id="intrastat_unit_kg_90_pct_sdt" model="intrastat.unit">
<field name="name">kg 90 pct sdt</field>
<field name="description">Kilogram of substance 90 % dry</field>
</record>
<record id="intrastat_unit_kg_U" model="intrastat.unit">
<field name="name">kg U</field>
<field name="description">Kilogram of uranium</field>
</record>
<record id="intrastat_unit_1000_kWh" model="intrastat.unit">
<field name="name">1000 kWh</field>
<field name="description">Thousand kilowatt hours</field>
</record>
<record id="intrastat_unit_l" model="intrastat.unit">
<field name="name">l</field>
<field name="description">Litre</field>
<field name="uom_id" ref="uom.product_uom_litre" />
</record>
<record id="intrastat_unit_1000l" model="intrastat.unit">
<field name="name">1000 l</field>
<field name="description">Thousand litres</field>
</record>
<record id="intrastat_unit_l_alc_100_pct" model="intrastat.unit">
<field name="name">l alc. 100 pct</field>
<field name="description">Litre pure (100 %) alcohol</field>
</record>
<record id="intrastat_unit_m" model="intrastat.unit">
<field name="name">m</field>
<field name="description">Metre</field>
<field name="uom_id" ref="uom.product_uom_meter" />
</record>
<record id="intrastat_unit_m2" model="intrastat.unit">
<field name="name">m2</field>
<field name="description">Square metre</field>
</record>
<record id="intrastat_unit_m3" model="intrastat.unit">
<field name="name">m3</field>
<field name="description">Cubic metre</field>
</record>
<record id="intrastat_unit_1000m3" model="intrastat.unit">
<field name="name">1000 m3</field>
<field name="description">Thousand cubic metres</field>
</record>
<record id="intrastat_unit_pa" model="intrastat.unit">
<field name="name">pa</field>
<field name="description">Number of pairs</field>
</record>
<record id="intrastat_unit_pce" model="intrastat.unit">
<field name="name">items</field>
<field name="description">Number of items</field>
<field name="uom_id" ref="uom.product_uom_unit" />
</record>
<record id="intrastat_unit_100pce" model="intrastat.unit">
<field name="name">100 items</field>
<field name="description">Hundred items</field>
</record>
<record id="intrastat_unit_1000pce" model="intrastat.unit">
<field name="name">1000 items</field>
<field name="description">Thousand items</field>
</record>
<record id="intrastat_unit_TJ" model="intrastat.unit">
<field name="name">TJ</field>
<field name="description">Terajoule (gross calorific value)</field>
</record>
</odoo>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
© 2011-2017 Akretion (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="product_harmonized_system.84715000" model="hs.code">
<field name="intrastat_unit_id" ref="intrastat_unit_pce" />
</record>
<record id="product_harmonized_system.84717050" model="hs.code">
<field name="intrastat_unit_id" ref="intrastat_unit_pce" />
</record>
<record id="base.main_company" model="res.company">
<field name="intrastat_arrivals">extended</field>
<field name="intrastat_dispatches">extended</field>
<field name="incoterm_id" ref="account.incoterm_DAP" />
<field name="intrastat_transport_id" ref="intrastat_transport_3" />
</record>
</odoo>

1590
intrastat_product/i18n/fr.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
# Copyright 2020 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).
def migrate(cr, version):
if not version:
return
cr.execute(
'ALTER TABLE "intrastat_product_declaration" RENAME "type" '
'TO "declaration_type"'
)

View File

@@ -0,0 +1,11 @@
from . import res_company
from . import res_config_settings
from . import account_move
from . import hs_code
from . import intrastat_product_declaration
from . import intrastat_region
from . import intrastat_transaction
from . import intrastat_transport_mode
from . import intrastat_unit
from . import sale_order
from . import stock_warehouse

View File

@@ -0,0 +1,166 @@
# Copyright 2011-2020 Akretion France (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = "account.move"
intrastat_transaction_id = fields.Many2one(
comodel_name="intrastat.transaction",
string="Intrastat Transaction Type",
ondelete="restrict",
tracking=True,
check_company=True,
help="Intrastat nature of transaction",
)
intrastat_transport_id = fields.Many2one(
comodel_name="intrastat.transport_mode",
string="Intrastat Transport Mode",
ondelete="restrict",
)
src_dest_country_id = fields.Many2one(
comodel_name="res.country",
string="Origin/Destination Country",
compute="_compute_src_dest_country_id",
store=True,
help="Destination country for dispatches. Origin country for " "arrivals.",
)
src_dest_region_id = fields.Many2one(
comodel_name="intrastat.region",
string="Origin/Destination Region",
default=lambda self: self._default_src_dest_region_id(),
help="Origin region for dispatches, destination region for "
"arrivals. This field is used for the Intrastat Declaration.",
ondelete="restrict",
)
intrastat = fields.Char(
string="Intrastat Declaration", related="company_id.intrastat"
)
intrastat_line_ids = fields.One2many(
comodel_name="account.move.intrastat.line",
inverse_name="move_id",
string="Intrastat declaration details",
)
@api.depends("partner_shipping_id.country_id", "partner_id.country_id")
def _compute_src_dest_country_id(self):
for inv in self:
country = inv.partner_shipping_id.country_id or inv.partner_id.country_id
if not country:
country = inv.company_id.country_id
inv.src_dest_country_id = country.id
@api.model
def _default_src_dest_region_id(self):
return self.env.company.intrastat_region_id
def compute_intrastat_lines(self):
"""
Compute the Intrastat Lines so that they can be modified
when encoding the Customer/Supplier Invoice.
"""
self.mapped("intrastat_line_ids").unlink()
for inv in self:
if inv.type not in ("out_invoice", "out_refund", "in_invoice", "in_refund"):
continue
line_vals = []
for line in inv.invoice_line_ids:
vals = self._get_intrastat_line_vals(line)
if vals:
line_vals.append(vals)
if line_vals:
inv.intrastat_line_ids = [(0, 0, x) for x in line_vals]
def _get_intrastat_line_vals(self, line):
vals = {}
decl_model = self.env["intrastat.product.declaration"]
if decl_model._is_product(line):
hs_code = line.product_id.get_hs_code_recursively()
if not hs_code:
return vals
weight, qty = decl_model._get_weight_and_supplunits(line, hs_code)
vals.update(
{
"invoice_line_id": line.id,
"hs_code_id": hs_code.id,
"transaction_weight": int(weight),
"transaction_suppl_unit_qty": qty,
"product_origin_country_id": line.product_id.origin_country_id.id,
}
)
return vals
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
hs_code_id = fields.Many2one(
comodel_name="hs.code",
compute="_compute_hs_code_id",
string="Intrastat Code",
)
def _compute_hs_code_id(self):
for rec in self:
intrastat_line = self.move_id.intrastat_line_ids.filtered(
lambda r: r.invoice_line_id == rec
)
rec.hs_code_id = intrastat_line.hs_code_id or rec.get_hs_code_recursively()
class AccountMoveIntrastatLine(models.Model):
_name = "account.move.intrastat.line"
_description = "Intrastat declaration details"
_order = "sequence"
move_id = fields.Many2one(
comodel_name="account.move",
string="Invoice",
ondelete="cascade",
required=True,
)
invoice_line_id = fields.Many2one(
comodel_name="account.move.line",
string="Invoice Line",
ondelete="cascade",
required=True,
)
sequence = fields.Integer(related="invoice_line_id.sequence", store=True)
product_id = fields.Many2one(
comodel_name="product.product",
string="Product",
related="invoice_line_id.product_id",
)
quantity = fields.Float(related="invoice_line_id.quantity")
transaction_suppl_unit_qty = fields.Float(
help="Transaction quantity in Intrastat Supplementary Unit"
)
hs_code_id = fields.Many2one(
comodel_name="hs.code",
string="Intrastat Code",
ondelete="restrict",
required=True,
)
transaction_weight = fields.Integer(
help="Transaction weight in Kg: Quantity x Product Weight"
)
product_origin_country_id = fields.Many2one(
comodel_name="res.country",
string="Country of Origin",
help="Country of origin of the product i.e. product " "'made in ____'.",
)
@api.onchange("invoice_line_id")
def _onchange_move_id(self):
moves = self.mapped("move_id")
dom = [
("exclude_from_invoice_tab", "=", False),
("display_type", "=", False),
("id", "in", moves.mapped("invoice_line_ids").ids),
("id", "not in", moves.mapped("intrastat_line_ids.invoice_line_id").ids),
]
return {"domain": {"invoice_line_id": dom}}

View File

@@ -0,0 +1,14 @@
# Copyright 2011-2020 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import fields, models
class HSCode(models.Model):
_inherit = "hs.code"
intrastat_unit_id = fields.Many2one(
comodel_name="intrastat.unit", string="Intrastat Supplementary Unit"
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
# Copyright 2009-2020 Noviat nv/sa (www.noviat.com).
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
class IntrastatRegion(models.Model):
_name = "intrastat.region"
_description = "Intrastat Region"
_sql_constraints = [
(
"intrastat_region_code_unique",
"UNIQUE(code, country_id)", # TODO add company_id ?
"Code must be unique.",
)
]
code = fields.Char(string="Code", required=True)
country_id = fields.Many2one(
comodel_name="res.country", string="Country", required=True
)
name = fields.Char(string="Name", translate=True)
description = fields.Char(string="Description")
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
default=lambda self: self._default_company_id(),
)
@api.model
def _default_company_id(self):
return self.env.company

View File

@@ -0,0 +1,42 @@
# Copyright 2011-2020 Akretion France (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
class IntrastatTransaction(models.Model):
_name = "intrastat.transaction"
_description = "Intrastat Transaction"
_order = "code"
_sql_constraints = [
(
"intrastat_transaction_code_unique",
"UNIQUE(code, company_id)",
"Code must be unique.",
)
]
code = fields.Char(string="Code", required=True)
description = fields.Text(string="Description")
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
default=lambda self: self._default_company_id(),
)
@api.model
def _default_company_id(self):
return self.env.company
@api.depends("code", "description")
def name_get(self):
res = []
for this in self:
name = this.code
if this.description:
name += " " + this.description
name = len(name) > 55 and name[:55] + "..." or name
res.append((this.id, name))
return res

View File

@@ -0,0 +1,27 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2019 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
class IntrastatTransportMode(models.Model):
_name = "intrastat.transport_mode"
_description = "Intrastat Transport Mode"
_order = "code"
_sql_constraints = [
("intrastat_transport_code_unique", "UNIQUE(code)", "Code must be unique.")
]
code = fields.Char(string="Code", required=True)
name = fields.Char(string="Name", required=True, translate=True)
description = fields.Char(string="Description", translate=True)
@api.depends("name", "code")
def name_get(self):
res = []
for mode in self:
name = "{}. {}".format(mode.code, mode.name)
res.append((mode.id, name))
return res

View File

@@ -0,0 +1,21 @@
# Copyright 2011-2020 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import fields, models
class IntrastatUnit(models.Model):
_name = "intrastat.unit"
_description = "Intrastat Supplementary Units"
name = fields.Char(string="Name", required=True)
description = fields.Char(string="Description", required=True)
uom_id = fields.Many2one(
comodel_name="uom.uom",
string="Regular UoM",
help="Select the regular Unit of Measure of Odoo that corresponds "
"to this Intrastat Supplementary Unit.",
)
active = fields.Boolean(default=True)

View File

@@ -0,0 +1,88 @@
# Copyright 2011-2017 Akretion (http://www.akretion.com)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = "res.company"
intrastat_arrivals = fields.Selection(
selection="_intrastat_arrivals",
string="Arrivals",
default="extended",
required=True,
)
intrastat_dispatches = fields.Selection(
selection="_intrastat_dispatches",
string="Dispatches",
default="extended",
required=True,
)
intrastat_transport_id = fields.Many2one(
comodel_name="intrastat.transport_mode",
string="Default Transport Mode",
ondelete="restrict",
)
intrastat = fields.Char(
string="Intrastat Declaration",
store=True,
readonly=True,
compute="_compute_intrastat",
)
intrastat_region_id = fields.Many2one(
comodel_name="intrastat.region", string="Default Intrastat Region"
)
intrastat_transaction_out_invoice = fields.Many2one(
comodel_name="intrastat.transaction",
string="Default Intrastat Transaction For Customer Invoice",
)
intrastat_transaction_out_refund = fields.Many2one(
comodel_name="intrastat.transaction",
string="Default Intrastat Transaction for Customer Refunds",
)
intrastat_transaction_in_invoice = fields.Many2one(
comodel_name="intrastat.transaction",
string="Default Intrastat Transaction For Supplier Invoices",
)
intrastat_transaction_in_refund = fields.Many2one(
comodel_name="intrastat.transaction",
string="Default Intrastat Transaction For Supplier Refunds",
)
intrastat_accessory_costs = fields.Boolean(
string="Include Accessory Costs in Fiscal Value of Product"
)
@api.model
def _intrastat_arrivals(self):
return [
("exempt", "Exempt"),
("standard", "Standard"),
("extended", "Extended"),
]
@api.model
def _intrastat_dispatches(self):
return [
("exempt", "Exempt"),
("standard", "Standard"),
("extended", "Extended"),
]
@api.depends("intrastat_arrivals", "intrastat_dispatches")
def _compute_intrastat(self):
for this in self:
if (
this.intrastat_arrivals == "exempt"
and this.intrastat_dispatches == "exempt"
):
this.intrastat = "exempt"
elif (
this.intrastat_arrivals == "extended"
or this.intrastat_dispatches == "extended"
):
this.intrastat = "extended"
else:
this.intrastat = "standard"

View File

@@ -0,0 +1,40 @@
# Copyright 2017-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
intrastat_arrivals = fields.Selection(
related="company_id.intrastat_arrivals", readonly=False
)
intrastat_dispatches = fields.Selection(
related="company_id.intrastat_dispatches", readonly=False
)
intrastat = fields.Char(related="company_id.intrastat")
intrastat_transport_id = fields.Many2one(
related="company_id.intrastat_transport_id", readonly=False
)
intrastat_region_id = fields.Many2one(
related="company_id.intrastat_region_id", readonly=False
)
intrastat_transaction_out_invoice = fields.Many2one(
related="company_id.intrastat_transaction_out_invoice", readonly=False
)
intrastat_transaction_out_refund = fields.Many2one(
related="company_id.intrastat_transaction_out_refund", readonly=False
)
intrastat_transaction_in_invoice = fields.Many2one(
related="company_id.intrastat_transaction_in_invoice", readonly=False
)
intrastat_transaction_in_refund = fields.Many2one(
related="company_id.intrastat_transaction_in_refund", readonly=False
)
intrastat_accessory_costs = fields.Boolean(
related="company_id.intrastat_accessory_costs", readonly=False
)
country_id = fields.Many2one(related="company_id.country_id")
# country_code is defined in the 'account' module

View File

@@ -0,0 +1,27 @@
# Copyright 2010-2020 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).
from odoo import fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
intrastat_transport_id = fields.Many2one(
comodel_name="intrastat.transport_mode",
string="Transport Mode",
help="This information is used in Intrastat reports",
)
intrastat = fields.Selection(
string="Intrastat Declaration", related="company_id.intrastat_dispatches"
)
def _prepare_invoice(self):
"""Copy destination country to invoice"""
vals = super()._prepare_invoice()
if self.intrastat_transport_id:
vals["intrastat_transport_id"] = self.intrastat_transport_id.id
if self.warehouse_id.region_id:
vals["src_dest_region_id"] = self.warehouse_id.region_id.id
return vals

View File

@@ -0,0 +1,27 @@
# Copyright 2009-2020 Noviat nv/sa (www.noviat.com).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
from odoo import fields, models
class StockWarehouse(models.Model):
_inherit = "stock.warehouse"
region_id = fields.Many2one(
comodel_name="intrastat.region", string="Intrastat Region"
)
class StockLocation(models.Model):
_inherit = "stock.location"
def get_intrastat_region(self):
self.ensure_one()
warehouse = self.env["stock.warehouse"].search(
[("lot_stock_id", "parent_of", self.ids), ("region_id", "!=", False)],
limit=1,
)
if warehouse:
return warehouse.region_id
return None

View File

@@ -0,0 +1,14 @@
By default the intrastat declaration is generated based upon the product record master data.
Hence unexpected results may occur in case this master data is not accurate,
e.g. wrong or missing weight, country of origin, ...
|
This can be corrected by changing the appropriate fields when analysing the intrastat declaration
but this can be challenging in case of large transaction volumes and especially in the specific use
case where the product weight cannot be encoded correctly on the product records (e.g. products with variable weight).
|
It is possible to allow encoding the intrastat transaction details on the purchase/sale invoice
via the "intrastat_product.group_invoice_intrastat_transaction_detail" usability group.

View File

@@ -0,0 +1,5 @@
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
* Luc De Meyer, Noviat <info@noviat.com>
* Tecnativa <www.tecnativa.com>:
* João Marques

View File

@@ -0,0 +1,11 @@
This module contains common objects and fields for the Intrastat Product reporting.
It should be used in combination with country-specific Intrastat Product reporting modules
such as:
- *l10n_fr_intrastat_product*:
the module for the *Déclaration d'Echange de Biens* (DEB) for France
- *l10n_be_intrastat_product*:
the module for the Intrastat Product Declaration for Belgium
These country-specific modules can be found in the OCA localization for those countries.

View File

@@ -0,0 +1 @@
This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.

View File

@@ -0,0 +1,3 @@
The declaration is based upon the invoices of the corresponding tax declaration period.
An option to generate the intrastat declaration based upon the dates of the physical movements of goods is currently not available.

View File

@@ -0,0 +1,33 @@
This module is used in combination with the country-specific
localization module(s).
**Coding guidelines for localization module:**
We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product
and adapt the code for the specific needs of your country.
* Declaration Object
Create a new class as follows:
.. code-block:: python
class L10nCcIntrastatProductDeclaration(models.Model):
_name = 'l10n.cc.intrastat.product.declaration'
_description = "Intrastat Product Declaration for YourCountry"
_inherit = ['intrastat.product.declaration', 'mail.thread']
whereby cc = your country code
* Computation & Declaration Lines
Create also new objects inheriting from the Computation and Declaration Line Objects
so that you can add methods or customise the methods from the base modules (make a PR when
the customization or new method is required for multiple countries).
Adapt also the parent_id fields of the newly created objects
(cf. l10n_be_intrastat_product as example).
* XML Files: Menu, Action, Views
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.

View File

@@ -0,0 +1 @@
from . import intrastat_product_report_xls

View File

@@ -0,0 +1,252 @@
# Copyright 2009-2020 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import _, models
from odoo.tools.translate import translate
from odoo.addons.report_xlsx_helper.report.report_xlsx_format import (
FORMATS,
XLS_HEADERS,
)
_logger = logging.getLogger(__name__)
IR_TRANSLATION_NAME = "intrastat.product.report"
class IntrastatProductDeclarationXlsx(models.AbstractModel):
_name = "report.intrastat_product.product_declaration_xls"
_inherit = "report.report_xlsx.abstract"
_description = "Intrastat declaration"
def _(self, src):
lang = self.env.context.get("lang", "en_US")
val = translate(self.env.cr, IR_TRANSLATION_NAME, "report", lang, src) or src
return val
def _get_template(self, declaration):
template = {
"product": {
"header": {"type": "string", "value": self._("Product")},
"line": {
"value": self._render("line.product_id and line.product_id.name")
},
"width": 36,
},
"product_origin_country": {
"header": {"type": "string", "value": self._("Product C/O")},
"line": {
"type": "string",
"value": self._render("line.product_origin_country_id.name or ''"),
},
"width": 28,
},
"hs_code": {
"header": {"type": "string", "value": self._("Intrastat Code")},
"line": {
"type": "string",
"value": self._render("line.hs_code_id.local_code"),
},
"width": 14,
},
"src_dest_country": {
"header": {
"type": "string",
"value": self._("Country of Origin/Destination"),
},
"line": {
"type": "string",
"value": self._render("line.src_dest_country_id.name"),
},
"width": 28,
},
"amount_company_currency": {
"header": {
"type": "string",
"value": self._("Fiscal Value"),
"format": FORMATS["format_theader_yellow_right"],
},
"line": {
"type": "number",
"value": self._render("line.amount_company_currency"),
"format": FORMATS["format_tcell_amount_right"],
},
"width": 18,
},
"accessory_cost": {
"header": {
"type": "string",
"value": self._("Accessory Costs"),
"format": FORMATS["format_theader_yellow_right"],
},
"line": {
"type": "number",
"value": self._render(
"line.amount_accessory_cost_company_currency"
),
"format": FORMATS["format_tcell_amount_right"],
},
"width": 18,
},
"transaction": {
"header": {"type": "string", "value": self._("Intrastat Transaction")},
"line": {"value": self._render("line.transaction_id.display_name")},
"width": 36,
},
"weight": {
"header": {
"type": "string",
"value": self._("Weight"),
"format": FORMATS["format_theader_yellow_right"],
},
"line": {
"type": "number",
"value": self._render("line.weight"),
"format": FORMATS["format_tcell_amount_right"],
},
"width": 18,
},
"suppl_unit_qty": {
"header": {
"type": "string",
"value": self._("Suppl. Unit Qty"),
"format": FORMATS["format_theader_yellow_right"],
},
"line": {
# we don't specify a type here and rely on the
# report_xlsx_helper type detection to use
# write_string when suppl_unit_qty is zero
"value": self._render("line.suppl_unit_qty or ''"),
"format": FORMATS["format_tcell_amount_right"],
},
"width": 18,
},
"suppl_unit": {
"header": {"type": "string", "value": self._("Suppl. Unit")},
"line": {"value": self._render("line.intrastat_unit_id.name or ''")},
"width": 14,
},
"incoterm": {
"header": {"type": "string", "value": self._("Incoterm")},
"line": {"value": self._render("line.incoterm_id.name or ''")},
"width": 14,
},
"transport": {
"header": {"type": "string", "value": self._("Transport Mode")},
"line": {"value": self._render("line.transport_id.name or ''")},
"width": 14,
},
"region": {
"header": {"type": "string", "value": self._("Intrastat Region")},
"line": {"value": self._render("line.region_id.name or ''")},
"width": 28,
},
"vat": {
"header": {"type": "string", "value": self._("VAT")},
"line": {"value": self._render("line.vat or ''")},
"width": 20,
},
"partner_id": {
"header": {"type": "string", "value": self._("Partner")},
"line": {"value": self._render("line.partner_id.display_name or ''")},
"width": 28,
},
"invoice": {
"header": {"type": "string", "value": self._("Invoice")},
"line": {"value": self._render("line.invoice_id.name")},
"width": 18,
},
}
template.update(declaration._xls_template())
return template
def _get_ws_params(self, wb, data, declaration):
template = self._get_template(declaration)
if self.env.context.get("computation_lines"):
wl = declaration._xls_computation_line_fields()
report = "computation"
else:
wl = declaration._xls_declaration_line_fields()
report = "declaration"
title = self._get_title(declaration, report, title_format="normal")
title_short = self._get_title(declaration, report, title_format="short")
sheet_name = title_short[:31].replace("/", "-")
params = {
"ws_name": sheet_name,
"generate_ws_method": "_intrastat_report",
"title": title,
"wanted_list": wl,
"col_specs": template,
}
return [params]
def _get_title(self, declaration, report, title_format="normal"):
title = declaration.year_month
if title_format == "normal":
if report == "computation":
title += " : " + _("Computation Lines")
else:
title += " : " + _("Declaration Lines")
return title
def _report_title(self, ws, row_pos, ws_params, data, declaration):
return self._write_ws_title(ws, row_pos, ws_params)
def _empty_report(self, ws, row_pos, ws_params, data, declaration, report):
if report == "computation":
lines = _("Computation Lines")
else:
lines = _("Declaration Lines")
no_entries = (
_("No") + " " + lines + " " + _("for period %s") % declaration.year_month
)
ws.write_string(row_pos, 0, no_entries, FORMATS["format_left_bold"])
def _intrastat_report(self, workbook, ws, ws_params, data, declaration):
ws.set_landscape()
ws.fit_to_pages(1, 0)
ws.set_header(XLS_HEADERS["xls_headers"]["standard"])
ws.set_footer(XLS_HEADERS["xls_footers"]["standard"])
self._set_column_width(ws, ws_params)
row_pos = 0
row_pos = self._report_title(ws, row_pos, ws_params, data, declaration)
if self.env.context.get("computation_lines"):
report = "computation"
lines = declaration.computation_line_ids
else:
report = "declaration"
lines = declaration.declaration_line_ids
if not lines:
return self._empty_report(ws, row_pos, ws_params, data, declaration, report)
row_pos = self._write_line(
ws,
row_pos,
ws_params,
col_specs_section="header",
default_format=FORMATS["format_theader_yellow_left"],
)
ws.freeze_panes(row_pos, 0)
for line in lines:
row_pos = self._write_line(
ws,
row_pos,
ws_params,
col_specs_section="line",
render_space={"line": line},
default_format=FORMATS["format_tcell_left"],
)

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="0">
<record id="group_invoice_intrastat_transaction_details" model="res.groups">
<field name="name">Invoice Intrastat Transaction Details</field>
<field
name="comment"
>Allow to encode Intrastat Transaction Details on Invoices</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>
</data>
<data noupdate="1">
<record id="intrastat_transaction_company_rule" model="ir.rule">
<field name="name">Intrastat Transaction Company rule</field>
<field name="model_id" ref="model_intrastat_transaction" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
<record id="intrastat_region_company_rule" model="ir.rule">
<field name="name">Intrastat Region Company rule</field>
<field name="model_id" ref="model_intrastat_region" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
<record id="intrastat_product_declaration_company_rule" model="ir.rule">
<field name="name">Intrastat Product Declaration Company rule</field>
<field name="model_id" ref="model_intrastat_product_declaration" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,14 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_intrastat_unit_read,Read access on Intrastat Supplementary Units to everybody,model_intrastat_unit,,1,0,0,0
access_intrastat_unit_full,Full access on Intrastat Supplementary Units to Finance manager,model_intrastat_unit,account.group_account_manager,1,1,1,1
access_intrastat_transaction_read,Read access on Intrastat Transaction Types to everybody,model_intrastat_transaction,,1,0,0,0
access_intrastat_transaction_full,Full access on Intrastat Transaction Types to Finance manager,model_intrastat_transaction,account.group_account_manager,1,1,1,1
access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to everybody,model_intrastat_transport_mode,,1,0,0,0
access_intrastat_transport_mode_full,Full access on Intrastat Transport Modes to Finance manager,model_intrastat_transport_mode,account.group_account_manager,1,1,1,1
access_intrastat_region_read,Read access on Intrastat Regions,model_intrastat_region,,1,0,0,0
access_intrastat_region_full,Full access on Intrastat Regions,model_intrastat_region,account.group_account_manager,1,1,1,1
access_hs_code_financial_mgr_full,Full access on H.S. Code to financial mgr,product_harmonized_system.model_hs_code,account.group_account_manager,1,1,1,1
access_account_move_intrastat_line,Full access on Invoice Intrastat Lines,model_account_move_intrastat_line,account.group_account_invoice,1,1,1,1
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_intrastat_unit_read Read access on Intrastat Supplementary Units to everybody model_intrastat_unit 1 0 0 0
3 access_intrastat_unit_full Full access on Intrastat Supplementary Units to Finance manager model_intrastat_unit account.group_account_manager 1 1 1 1
4 access_intrastat_transaction_read Read access on Intrastat Transaction Types to everybody model_intrastat_transaction 1 0 0 0
5 access_intrastat_transaction_full Full access on Intrastat Transaction Types to Finance manager model_intrastat_transaction account.group_account_manager 1 1 1 1
6 access_intrastat_transport_mode_read Read access on Intrastat Transport Modes to everybody model_intrastat_transport_mode 1 0 0 0
7 access_intrastat_transport_mode_full Full access on Intrastat Transport Modes to Finance manager model_intrastat_transport_mode account.group_account_manager 1 1 1 1
8 access_intrastat_region_read Read access on Intrastat Regions model_intrastat_region 1 0 0 0
9 access_intrastat_region_full Full access on Intrastat Regions model_intrastat_region account.group_account_manager 1 1 1 1
10 access_hs_code_financial_mgr_full Full access on H.S. Code to financial mgr product_harmonized_system.model_hs_code account.group_account_manager 1 1 1 1
11 access_account_move_intrastat_line Full access on Invoice Intrastat Lines model_account_move_intrastat_line account.group_account_invoice 1 1 1 1
12 access_intrastat_product_declaration Full access on Intrastat Product Declarations to Accountant model_intrastat_product_declaration account.group_account_user 1 1 1 1
13 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
14 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,500 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Intrastat Product</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="intrastat-product">
<h1 class="title">Intrastat Product</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/14.0/intrastat_product"><img alt="OCA/intrastat-extrastat" src="https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/intrastat-extrastat-14-0/intrastat-extrastat-14-0-intrastat_product"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/227/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module contains common objects and fields for the Intrastat Product reporting.</p>
<p>It should be used in combination with country-specific Intrastat Product reporting modules
such as:</p>
<ul class="simple">
<li><em>l10n_fr_intrastat_product</em>:
the module for the <em>Déclaration dEchange de Biens</em> (DEB) for France</li>
<li><em>l10n_be_intrastat_product</em>:
the module for the Intrastat Product Declaration for Belgium</li>
</ul>
<p>These country-specific modules can be found in the OCA localization for those countries.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
<li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id4">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id5">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id6">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id7">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id8">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#id1">Installation</a></h1>
<p>This module is NOT compatible with the <em>account_intrastat</em> module from Odoo Enterprise.</p>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id2">Configuration</a></h1>
<p>By default the intrastat declaration is generated based upon the product record master data.
Hence unexpected results may occur in case this master data is not accurate,
e.g. wrong or missing weight, country of origin, …</p>
<div class="line-block">
<div class="line"><br /></div>
</div>
<p>This can be corrected by changing the appropriate fields when analysing the intrastat declaration
but this can be challenging in case of large transaction volumes and especially in the specific use
case where the product weight cannot be encoded correctly on the product records (e.g. products with variable weight).</p>
<div class="line-block">
<div class="line"><br /></div>
</div>
<p>It is possible to allow encoding the intrastat transaction details on the purchase/sale invoice
via the “intrastat_product.group_invoice_intrastat_transaction_detail” usability group.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id3">Usage</a></h1>
<p>This module is used in combination with the country-specific
localization module(s).</p>
<p><strong>Coding guidelines for localization module:</strong></p>
<p>We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product
and adapt the code for the specific needs of your country.</p>
<ul>
<li><p class="first">Declaration Object</p>
<p>Create a new class as follows:</p>
<pre class="code python literal-block">
<span class="k">class</span> <span class="nc">L10nCcIntrastatProductDeclaration</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="n">_name</span> <span class="o">=</span> <span class="s1">'l10n.cc.intrastat.product.declaration'</span>
<span class="n">_description</span> <span class="o">=</span> <span class="s2">&quot;Intrastat Product Declaration for YourCountry&quot;</span>
<span class="n">_inherit</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'intrastat.product.declaration'</span><span class="p">,</span> <span class="s1">'mail.thread'</span><span class="p">]</span>
</pre>
<p>whereby cc = your country code</p>
</li>
<li><p class="first">Computation &amp; Declaration Lines</p>
<p>Create also new objects inheriting from the Computation and Declaration Line Objects
so that you can add methods or customise the methods from the base modules (make a PR when
the customization or new method is required for multiple countries).</p>
<p>Adapt also the parent_id fields of the newly created objects
(cf. l10n_be_intrastat_product as example).</p>
</li>
<li><p class="first">XML Files: Menu, Action, Views</p>
<p>Cf. l10n_be_istrastat_product as example, replace “be” by your Country Code.</p>
</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id4">Known issues / Roadmap</a></h1>
<p>The declaration is based upon the invoices of the corresponding tax declaration period.</p>
<p>An option to generate the intrastat declaration based upon the dates of the physical movements of goods is currently not available.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id6">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id7">Authors</a></h2>
<ul class="simple">
<li>brain-tec AG</li>
<li>Akretion</li>
<li>Noviat</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id8">Contributors</a></h2>
<ul>
<li><p class="first">Alexis de Lattre, Akretion &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</p>
</li>
<li><p class="first">Luc De Meyer, Noviat &lt;<a class="reference external" href="mailto:info&#64;noviat.com">info&#64;noviat.com</a>&gt;</p>
</li>
<li><p class="first">Tecnativa &lt;www.tecnativa.com&gt;:</p>
<blockquote>
<ul class="simple">
<li>João Marques</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/intrastat-extrastat/tree/14.0/intrastat_product">OCA/intrastat-extrastat</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">intrastat.invoice.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath
expr="//page[@name='other_info']//field[@name='invoice_incoterm_id']"
position="after"
>
<field
name="intrastat_transaction_id"
domain="[('company_id', '=', company_id)]"
/>
<field name="intrastat" invisible="1" />
<field
name="intrastat_transport_id"
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
widget="selection"
/>
<field name="src_dest_country_id" string="Destination Country" />
<field name="src_dest_region_id" string="Origin Region" invisible="1" />
</xpath>
<page id="invoice_tab" position="after">
<page
id="intrastat_lines"
string="Intrastat transaction details"
groups="intrastat_product.group_invoice_intrastat_transaction_details"
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}"
>
<div>
<button
type="object"
name="compute_intrastat_lines"
string="Compute"
help="(Re)compute the intrastat transaction details from the product master data."
icon="fa-gears"
/>
</div>
<field name="intrastat_line_ids">
<tree editable="bottom">
<field
name="invoice_line_id"
domain="[('exclude_from_invoice_tab', '=', False), ('move_id', '=', parent.id), ('display_type', '=', False)]"
options="{'no_create': True, 'no_open': True}"
/>
<field name="product_id" />
<field name="quantity" />
<field name="transaction_suppl_unit_qty" />
<field name="hs_code_id" />
<field name="transaction_weight" />
<field
name="product_origin_country_id"
options="{'no_create': True, 'no_open': True}"
/>
</tree>
</field>
</page>
</page>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2020 Akretion (http://www.akretion.com/)
Copyright 2015-2020 Noviat (http://www.noviat.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
@author Luc De Meyer <luc.demeyer@noviat.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- Add the H.S. code menu under the Intrastat Config menu -->
<menuitem
id="intrastat_code_menu"
action="product_harmonized_system.hs_code_action"
parent="intrastat_base.menu_intrastat_config_root"
sequence="10"
/>
<!-- Inherit tree view of H.S. code -->
<record id="hs_code_tree" model="ir.ui.view">
<field name="name">intrastat.hs.code.tree</field>
<field name="model">hs.code</field>
<field name="inherit_id" ref="product_harmonized_system.hs_code_view_tree" />
<field name="arch" type="xml">
<field name="local_code" position="after">
<field name="intrastat_unit_id" />
</field>
</field>
</record>
<!-- Inherit form view for H.S. code -->
<record id="hs_code_form" model="ir.ui.view">
<field name="name">intrastat.hs.code.form</field>
<field name="model">hs.code</field>
<field name="inherit_id" ref="product_harmonized_system.hs_code_view_form" />
<field name="arch" type="xml">
<field name="local_code" position="after">
<field name="intrastat_unit_id" />
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,378 @@
<?xml version="1.0" ?>
<odoo>
<record id="intrastat_product_declaration_view_form" model="ir.ui.view">
<field name="name">intrastat.product.declaration.form</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<form string="Intrastat Product Declaration">
<header>
<button
name="action_gather"
type="object"
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}"
string="Generate Lines from Invoices"
class="btn-primary"
/>
<button
name="generate_declaration"
type="object"
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}"
string="Generate Declaration Lines"
/>
<button
name="generate_xml"
string="Generate XML Declaration File"
type="object"
attrs="{'invisible': [('xml_attachment_id', '!=', False)]}"
invisible="context.get('generic_intrastat_product_declaration')"
/>
<button
name="delete_xml"
string="Delete XML Export"
type="object"
attrs="{'invisible': [('xml_attachment_id', '=', False)]}"
/>
<button
name="done"
string="Done"
type="object"
class="btn-primary"
states="draft"
/>
<button
name="back2draft"
string="Back to Draft"
type="object"
states="done"
/>
<field name="state" widget="statusbar" />
</header>
<sheet string="Intrastat Product Declaration">
<div class="oe_title">
<h1>
<span>Intrastat Product Declaration </span>
<field name="year_month" class="oe_inline" />
</h1>
</div>
<group name="top-block">
<group name="properties-1">
<field name="year" />
<field name="month" />
<field name="declaration_type" />
<field
name="xml_attachment_datas"
filename="xml_attachment_name"
invisible="context.get('generic_intrastat_product_declaration')"
/>
<field name="xml_attachment_name" invisible="1" />
<field name="xml_attachment_id" invisible="1" />
<field name="reporting_level" invisible="1" />
</group>
<group name="properties-2">
<field name="action" />
<field name="revision" />
<field
name="total_amount"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
<field name="num_decl_lines" />
<field
name="company_id"
groups="base.group_multi_company"
/>
<field name="company_country_code" invisible="1" />
<field name="currency_id" invisible="1" />
</group>
</group>
<notebook>
<page string="Transactions">
<header>
<button
name="create_xls"
type="object"
string="Excel Export"
context="{'computation_lines': 1}"
/>
</header>
<group name="computation_lines">
<field
name="computation_line_ids"
context="{'declaration_type': declaration_type, 'reporting_level': reporting_level}"
nolabel="1"
/>
</group>
</page>
<page string="Declaration Lines">
<header>
<button
name="create_xls"
type="object"
string="Excel Export"
context="{'declaration_lines': 1}"
/>
</header>
<group name="declaration_lines">
<field
name="declaration_line_ids"
context="{'declaration_type': declaration_type, 'reporting_level': reporting_level}"
nolabel="1"
/>
</group>
</page>
<page string="Notes">
<field name="note" />
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
<record id="intrastat_product_declaration_view_tree" model="ir.ui.view">
<field name="name">intrastat.product.declaration.tree</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<tree
string="Intrastat Product Declarations"
decoration-info="state=='draft'"
>
<field name="year_month" />
<field name="revision" />
<field name="declaration_type" />
<field name="num_decl_lines" />
<field name="total_amount" sum="Total amount" />
<field name="currency_id" />
<field name="state" />
</tree>
</field>
</record>
<record id="intrastat_product_declaration_view_search" model="ir.ui.view">
<field name="name">intrastat.product.declaration.search</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<search string="Search Intrastat Product Declarations">
<field name="year_month" />
<filter
name="arrivals"
string="Arrivals"
domain="[('declaration_type', '=', 'arrivals')]"
/>
<filter
name="dispatches"
string="Dispatches"
domain="[('declaration_type', '=', 'dispatches')]"
/>
<separator />
<filter
name="draft"
string="Draft"
domain="[('state', '=', 'draft')]"
/>
<filter name="done" string="Done" domain="[('state', '=', 'done')]" />
<group string="Group By" name="group_by">
<filter
name="date_group_by"
string="Date"
context="{'group_by': 'year_month'}"
/>
<filter
name="declaration_type_group_by"
string="Type"
context="{'group_by': 'declaration_type'}"
/>
</group>
</search>
</field>
</record>
<record id="intrastat_product_declaration_view_graph" model="ir.ui.view">
<field name="name">intrastat.product.declaration.graph</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<graph string="Intrastat Product" type="bar" stacked="False">
<field name="year_month" type="row" />
<field name="declaration_type" type="row" />
<field name="total_amount" type="measure" />
</graph>
</field>
</record>
<record id="intrastat_product_declaration_view_pivot" model="ir.ui.view">
<field name="name">intrastat.product.declaration.pivot</field>
<field name="model">intrastat.product.declaration</field>
<field name="arch" type="xml">
<pivot string="Intrastat Product">
<field name="year_month" type="row" />
<field name="declaration_type" type="col" />
<field name="total_amount" type="measure" />
</pivot>
</field>
</record>
<!-- No menuitem nor action since these are provided by the localization modules -->
<record id="intrastat_product_computation_line_view_form" model="ir.ui.view">
<field name="name">intrastat.product.computation.line.form</field>
<field name="model">intrastat.product.computation.line</field>
<field name="arch" type="xml">
<form string="Intrastat Transaction">
<group string="Transaction" name="transaction">
<field
name="parent_id"
invisible="not context.get('intrastat_product_computation_line_main_view')"
/>
<field name="product_id" />
<field name="hs_code_id" />
<field name="src_dest_country_id" />
<field
name="amount_company_currency"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
/>
<field
name="amount_accessory_cost_company_currency"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
/>
<field name="company_currency_id" invisible="1" />
<field name="transaction_id" />
<label for="weight" />
<div name="weight">
<field name="weight" class="oe_inline" /> Kg
</div>
<field name="suppl_unit_qty" />
<field name="intrastat_unit_id" />
<field name="declaration_type" invisible="1" />
<field name="reporting_level" invisible="1" />
<field
name="transport_id"
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
/>
<field name="incoterm_id" invisible="1" />
<field name="region_id" invisible="1" />
<field name="product_origin_country_id" invisible="1" />
<field name="vat" />
<field name="partner_id" />
<field name="invoice_id" />
</group>
<group string="Declaration" name="declaration">
<field name="declaration_line_id" />
</group>
</form>
</field>
</record>
<record id="intrastat_product_computation_line_view_tree" model="ir.ui.view">
<field name="name">intrastat.product.computation.line.tree</field>
<field name="model">intrastat.product.computation.line</field>
<field name="arch" type="xml">
<tree string="Transactions">
<field
name="parent_id"
invisible="not context.get('intrastat_product_computation_line_main_view')"
/>
<field name="product_id" />
<field name="hs_code_id" />
<field name="src_dest_country_id" />
<field name="amount_company_currency" />
<field name="amount_accessory_cost_company_currency" />
<field name="transaction_id" />
<field name="weight" />
<field
name="suppl_unit_qty"
attrs="{'invisible': [('intrastat_unit_id', '=', False)], 'required': [('intrastat_unit_id', '!=', False)]}"
/>
<field name="intrastat_unit_id" />
<field
name="transport_id"
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
/>
<field name="region_id" invisible="1" />
<field
name="product_origin_country_id"
invisible="1"
string="Product C/O"
/>
<field name="vat" />
<field name="invoice_id" />
<field name="declaration_type" invisible="1" />
<field name="reporting_level" invisible="1" />
</tree>
</field>
</record>
<record id="intrastat_product_declaration_line_view_form" model="ir.ui.view">
<field name="name">intrastat.product.declaration.line.form</field>
<field name="model">intrastat.product.declaration.line</field>
<field name="arch" type="xml">
<form string="Intrastat Declaration Line">
<group name="declaration">
<field
name="parent_id"
invisible="not context.get('intrastat_product_declaration_line_main_view')"
/>
<field name="hs_code_id" />
<field name="src_dest_country_id" />
<field
name="amount_company_currency"
widget="monetary"
options="{'currency_field': 'company_currency_id'}"
/>
<field name="company_currency_id" invisible="1" />
<field name="transaction_id" />
<label for="weight" />
<div name="weight">
<field name="weight" class="oe_inline" /> Kg
</div>
<field name="suppl_unit_qty" />
<field name="intrastat_unit_id" />
<field name="declaration_type" invisible="1" />
<field name="reporting_level" invisible="1" />
<field
name="transport_id"
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
/>
<field name="region_id" invisible="1" />
<field name="incoterm_id" invisible="1" />
<field name="product_origin_country_id" invisible="1" />
<field name="vat" />
</group>
<group name="computation" string="Related Transactions">
<field name="computation_line_ids" nolabel="1" />
</group>
</form>
</field>
</record>
<record id="intrastat_product_declaration_line_view_tree" model="ir.ui.view">
<field name="name">intrastat.product.declaration.line.tree</field>
<field name="model">intrastat.product.declaration.line</field>
<field name="arch" type="xml">
<tree string="Intrastat Declaration Lines">
<field
name="parent_id"
invisible="not context.get('intrastat_product_declaration_line_main_view')"
/>
<field name="hs_code_id" />
<field name="src_dest_country_id" />
<field name="amount_company_currency" />
<field name="transaction_id" />
<field name="weight" />
<field name="suppl_unit_qty" />
<field name="intrastat_unit_id" />
<field name="declaration_type" invisible="1" />
<field name="reporting_level" invisible="1" />
<field
name="transport_id"
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"
/>
<field name="region_id" invisible="1" />
<field name="incoterm_id" invisible="1" />
<field
name="product_origin_country_id"
invisible="1"
string="Product C/O"
/>
<field name="vat" />
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="intrastat_region_view_form" model="ir.ui.view">
<field name="name">intrastat.region.form</field>
<field name="model">intrastat.region</field>
<field name="arch" type="xml">
<form string="Intrastat Region">
<group name="main">
<field name="code" />
<field name="name" />
<field name="description" />
<field name="country_id" />
<field name="company_id" groups="base.group_multi_company" />
</group>
</form>
</field>
</record>
<record id="intrastat_region_view_tree" model="ir.ui.view">
<field name="name">intrastat.region.tree</field>
<field name="model">intrastat.region</field>
<field name="arch" type="xml">
<tree string="Intrastat Region">
<field name="code" />
<field name="name" />
<field name="description" optional="show" />
<field name="country_id" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
</record>
<record id="intrastat_region_action" model="ir.actions.act_window">
<field name="name">Intrastat Regions</field>
<field name="res_model">intrastat.region</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="intrastat_region_menu"
action="intrastat_region_action"
parent="intrastat_base.menu_intrastat_config_root"
sequence="50"
/>
</odoo>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2020 Akretion (http://www.akretion.com/)
Copyright 2015-2020 Noviat (http://www.noviat.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
@author Luc De Meyer <luc.demeyer@noviat.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- Intrastat Transaction Type -->
<record id="intrastat_transaction_form" model="ir.ui.view">
<field name="name">intrastat.transaction_form</field>
<field name="model">intrastat.transaction</field>
<field name="arch" type="xml">
<form string="Intrastat Transaction Type">
<group>
<field name="code" />
<field name="description" />
<field name="company_id" groups="base.group_multi_company" />
</group>
</form>
</field>
</record>
<record id="intrastat_transaction_tree" model="ir.ui.view">
<field name="name">intrastat.transaction_tree</field>
<field name="model">intrastat.transaction</field>
<field name="arch" type="xml">
<tree string="Intrastat Transaction Types">
<field name="code" />
<field name="description" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
</record>
<record id="intrastat_transaction_mode_search" model="ir.ui.view">
<field name="name">intrastat.transaction.mode.search</field>
<field name="model">intrastat.transaction</field>
<field name="arch" type="xml">
<search string="Search Intrastat Transaction Types">
<field
name="description"
string="Code or Description"
filter_domain="['|', ('code', 'ilike', self), ('description', 'ilike', self)]"
/>
<group string="Group By" name="groupby">
<filter
name="company_groupby"
string="Company"
context="{'group_by': 'company_id'}"
/>
</group>
</search>
</field>
</record>
<record id="intrastat_transaction_action" model="ir.actions.act_window">
<field name="name">Transaction Types</field>
<field name="res_model">intrastat.transaction</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="intrastat_transaction_menu"
action="intrastat_transaction_action"
parent="intrastat_base.menu_intrastat_config_root"
sequence="20"
/>
</odoo>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
© 2010-2017 Akretion (http://www.akretion.com/)
© 2015-2017 Noviat (http://www.noviat.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
@author Luc De Meyer <luc.demeyer@noviat.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- Intrastat Transport Mode -->
<record id="intrastat_transport_mode_form" model="ir.ui.view">
<field name="name">intrastat.transport.mode.form</field>
<field name="model">intrastat.transport_mode</field>
<field name="arch" type="xml">
<form string="Intrastat Transport Mode">
<group>
<field name="name" />
<field name="code" />
<field name="description" />
</group>
</form>
</field>
</record>
<record id="intrastat_transport_mode_tree" model="ir.ui.view">
<field name="name">intrastat.transport.mode.tree</field>
<field name="model">intrastat.transport_mode</field>
<field name="arch" type="xml">
<tree string="Intrastat Transportat Modes">
<field name="code" />
<field name="name" />
<field name="description" optional="show" />
</tree>
</field>
</record>
<record id="intrastat_transport_mode_search" model="ir.ui.view">
<field name="name">intrastat.transport.mode.search</field>
<field name="model">intrastat.transport_mode</field>
<field name="arch" type="xml">
<search string="Search Intrastat Transport Modes">
<field
name="name"
string="Name, Code or Description"
filter_domain="['|', '|', ('name', 'ilike', self), ('description', 'ilike', self), ('code', 'ilike', self)]"
/>
</search>
</field>
</record>
<record id="intrastat_transport_action" model="ir.actions.act_window">
<field name="name">Transport Modes</field>
<field name="res_model">intrastat.transport_mode</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="intrastat_transport_menu"
action="intrastat_transport_action"
parent="intrastat_base.menu_intrastat_config_root"
sequence="30"
/>
</odoo>

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
© 2010-2017 Akretion (http://www.akretion.com/)
© 2015-2017 Noviat (http://www.noviat.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
@author Luc De Meyer <luc.demeyer@noviat.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- Intrastat Supplementary Unit -->
<record id="intrastat_unit_form" model="ir.ui.view">
<field name="name">intrastat.unit.form</field>
<field name="model">intrastat.unit</field>
<field name="arch" type="xml">
<form string="Intrastat Supplementary Unit">
<field name="active" invisible="1" />
<widget
name="web_ribbon"
text="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<group name="main">
<field name="name" />
<field name="uom_id" required="1" />
<field name="description" />
</group>
</form>
</field>
</record>
<record id="intrastat_unit_tree" model="ir.ui.view">
<field name="name">intrastat.unit.tree</field>
<field name="model">intrastat.unit</field>
<field name="arch" type="xml">
<tree string="Intrastat Supplementary Units">
<field name="name" />
<field name="uom_id" />
<field name="description" optional="show" />
</tree>
</field>
</record>
<record id="intrastat_unit_search" model="ir.ui.view">
<field name="name">intrastat.unit.search</field>
<field name="model">intrastat.unit</field>
<field name="arch" type="xml">
<search string="Search Intrastat Supplementary Units">
<field
name="name"
filter_domain="['|', ('name', 'ilike', self), ('description', 'ilike', self)]"
/>
<filter
string="Archived"
name="inactive"
domain="[('active', '=', False)]"
/>
<group string="Group By" name="groupby">
<filter
name="uom_groupby"
string="Regular UoM"
context="{'group_by': 'uom_id'}"
/>
</group>
</search>
</field>
</record>
<record id="intrastat_unit_action" model="ir.actions.act_window">
<field name="name">Supplementary Units</field>
<field name="res_model">intrastat.unit</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="intrastat_unit_menu"
action="intrastat_unit_action"
parent="intrastat_base.menu_intrastat_config_root"
sequence="40"
/>
</odoo>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" ?>
<!--
Copyright 2018-2020 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
Copyright 2019-2020 Noviat (www.noviat.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_res_config_settings" model="ir.ui.view">
<field name="name">intrastat.account.config.settings.form</field>
<field name="model">res.config.settings</field>
<field
name="inherit_id"
ref="intrastat_base.view_intrastat_res_config_settings"
/>
<field name="arch" type="xml">
<div id="intrastat-settings" position="inside">
<div class="o_setting_left_pane" />
<div
class="o_setting_right_pane"
id="intrastat-product-main-params"
>
<div class="row">
<label for="intrastat_arrivals" class="col-md-5" />
<field name="intrastat_arrivals" />
<field name="country_id" invisible="1" />
</div>
<div class="row">
<label for="intrastat_dispatches" class="col-md-5" />
<field name="intrastat_dispatches" />
</div>
<div class="row">
<label for="intrastat_transport_id" class="col-md-5" />
<field name="intrastat_transport_id" />
</div>
<div class="row">
<label
for="intrastat_transaction_out_invoice"
class="col-md-5"
/>
<field name="intrastat_transaction_out_invoice" />
</div>
<div class="row">
<label
for="intrastat_transaction_out_refund"
class="col-md-5"
/>
<field name="intrastat_transaction_out_refund" />
</div>
<div class="row">
<label
for="intrastat_transaction_in_invoice"
class="col-md-5"
/>
<field name="intrastat_transaction_in_invoice" />
</div>
<div
class="row"
attrs="{'invisible': [('country_code', 'in', ['FR'])]}"
>
<label
for="intrastat_transaction_in_refund"
class="col-md-5"
/>
<field name="intrastat_transaction_in_refund" />
</div>
<div
class="row"
attrs="{'invisible': [('country_code', 'not in', ['BE'])]}"
>
<label for="intrastat_region_id" class="col-md-5" />
<field
name="intrastat_region_id"
domain="[('country_id','=', country_id)]"
/>
</div>
</div>
<div class="o_setting_left_pane">
<field
name="intrastat_accessory_costs"
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"
/>
</div>
<div class="o_setting_right_pane">
<div class="row">
<label
for="intrastat_accessory_costs"
class="col-12"
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"
/>
</div>
</div>
</div>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" ?>
<odoo>
<record id="sale_order_form" model="ir.ui.view">
<field name="name">intrastat.sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock" />
<field name="arch" type="xml">
<field name="incoterm" position="after">
<field
name="intrastat_transport_id"
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
widget="selection"
/>
<field name="intrastat" invisible="1" />
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<odoo>
<record id="view_warehouse" model="ir.ui.view">
<field name="name">intrastat.stock.warehouse.form</field>
<field name="model">stock.warehouse</field>
<field name="inherit_id" ref="stock.view_warehouse" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="region_id" />
</field>
</field>
</record>
</odoo>

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
python-stdnum>=1.16

View File

@@ -0,0 +1 @@
../../../../intrastat_product

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)