Skip to content

Commit

Permalink
intrastat_product: auto reformatting to prepare v17 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Mar 26, 2024
1 parent fa64996 commit ef41f02
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 180 deletions.
129 changes: 71 additions & 58 deletions intrastat_product/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,30 @@ Intrastat Product
: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/16.0/intrastat_product
:target: https://github.com/OCA/intrastat-extrastat/tree/17.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-16-0/intrastat-extrastat-16-0-intrastat_product
:target: https://translation.odoo-community.org/projects/intrastat-extrastat-17-0/intrastat-extrastat-17-0-intrastat_product
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/intrastat-extrastat&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module contains common objects and fields for the Intrastat Product reporting.
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:
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
- *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.
These country-specific modules can be found in the OCA localization for
those countries.

**Table of contents**

Expand All @@ -48,25 +50,27 @@ These country-specific modules can be found in the OCA localization for those co
Installation
============

This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.
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, ...
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).

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.
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
=====
Expand All @@ -76,82 +80,91 @@ 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.
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
- Declaration Object

Create a new class as follows:
Create a new class as follows:

.. code-block:: python
.. code:: python
class L10nCcIntrastatProductDeclaration(models.Model):
_name = 'l10n.cc.intrastat.product.declaration'
_description = "Intrastat Product Declaration for YourCountry"
_inherit = ['intrastat.product.declaration', 'mail.thread']
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
whereby cc = your country code

* Computation & Declaration Lines
- 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).
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).
Adapt also the parent_id fields of the newly created objects (cf.
l10n_be_intrastat_product as example).

* XML Files: Menu, Action, Views
- XML Files: Menu, Action, Views

Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.
Cf. l10n_be_istrastat_product as example, replace "be" by your
Country Code.

**Other functionality added by this module:**

* Compute the Intrastat Lines in an invoice.
For this, your user needs to be in the "Technical / Invoice Intrastat Transaction Details" group.
Go to the "Intrastat transaction details" tab and press **Compute**
- Compute the Intrastat Lines in an invoice. For this, your user needs
to be in the "Technical / Invoice Intrastat Transaction Details"
group. Go to the "Intrastat transaction details" tab and press
**Compute**

Known issues / Roadmap
======================

The declaration is based upon the invoices of the corresponding tax declaration period.
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.
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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/intrastat-extrastat/issues/new?body=module:%20intrastat_product%0Aversion:%2017.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
~~~~~~~
-------

* ACSONE SA/NV
* brain-tec AG
* Akretion
* Noviat

Contributors
~~~~~~~~~~~~
------------

- Alexis de Lattre, Akretion <alexis.delattre@akretion.com>

- Luc De Meyer, Noviat <info@noviat.com>

- Denis Roussel <denis.roussel@acsone.eu>

* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
* Luc De Meyer, Noviat <info@noviat.com>
* Denis Roussel <denis.roussel@acsone.eu>
* Tecnativa <www.tecnativa.com>:
- Tecnativa <`www.tecnativa.com <http://www.tecnativa.com>`__>:

* João Marques
* Víctor Martínez
- João Marques
- Víctor Martínez

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -163,6 +176,6 @@ 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/16.0/intrastat_product>`_ project on GitHub.
This module is part of the `OCA/intrastat-extrastat <https://github.com/OCA/intrastat-extrastat/tree/17.0/intrastat_product>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
11 changes: 5 additions & 6 deletions intrastat_product/models/intrastat_product_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _attach_xml_file(self, xml_bytes, declaration_name):
"""Attach the XML file to the report_intrastat_product/service
object"""
self.ensure_one()
filename = "{}_{}.xml".format(self.year_month, declaration_name)
filename = f"{self.year_month}_{declaration_name}.xml"
attach = self.env["ir.attachment"].create(
{
"name": filename,
Expand Down Expand Up @@ -549,9 +549,9 @@ def _handle_invoice_accessory_cost(
)
else:
for ac_line_vals in lines_current_invoice:
ac_line_vals[
"amount_accessory_cost_company_currency"
] = total_inv_accessory_costs_cc / len(lines_current_invoice)
ac_line_vals["amount_accessory_cost_company_currency"] = (
total_inv_accessory_costs_cc / len(lines_current_invoice)
)

def _prepare_invoice_domain(self):
"""
Expand Down Expand Up @@ -602,7 +602,6 @@ def _gather_invoices(self, notedict):
invoices = self.env["account.move"].search(domain, order=order)

for invoice in invoices:

lines_current_invoice = []
total_inv_accessory_costs_cc = 0.0 # in company currency
total_inv_product_cc = 0.0 # in company currency
Expand Down Expand Up @@ -890,7 +889,7 @@ def generate_xml(self):
xml_bytes = self._generate_xml()
if xml_bytes:
attach_id = self._attach_xml_file(
xml_bytes, "{}_{}".format(self.declaration_type, self.revision)
xml_bytes, f"{self.declaration_type}_{self.revision}"
)
self.write({"xml_attachment_id": attach_id})

Expand Down
2 changes: 1 addition & 1 deletion intrastat_product/models/intrastat_transport_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class IntrastatTransportMode(models.Model):
def name_get(self):
res = []
for mode in self:
name = "{}. {}".format(mode.code, mode.name)
name = f"{mode.code}. {mode.name}"
res.append((mode.id, name))
return res
3 changes: 3 additions & 0 deletions intrastat_product/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
15 changes: 15 additions & 0 deletions intrastat_product/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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.
14 changes: 0 additions & 14 deletions intrastat_product/readme/CONFIGURE.rst

This file was deleted.

10 changes: 10 additions & 0 deletions intrastat_product/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- Alexis de Lattre, Akretion \<<alexis.delattre@akretion.com>\>

- Luc De Meyer, Noviat \<<info@noviat.com>\>

- Denis Roussel \<<denis.roussel@acsone.eu>\>

- Tecnativa \<www.tecnativa.com\>:

> - João Marques
> - Víctor Martínez
7 changes: 0 additions & 7 deletions intrastat_product/readme/CONTRIBUTORS.rst

This file was deleted.

13 changes: 13 additions & 0 deletions intrastat_product/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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.
11 changes: 0 additions & 11 deletions intrastat_product/readme/DESCRIPTION.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise.
This module is NOT compatible with the *account_intrastat* module from
Odoo Enterprise.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
The declaration is based upon the invoices of the corresponding tax declaration period.
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.
An option to generate the intrastat declaration based upon the dates of
the physical movements of goods is currently not available.
43 changes: 43 additions & 0 deletions intrastat_product/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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:

``` 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.

**Other functionality added by this module:**

- Compute the Intrastat Lines in an invoice. For this, your user needs
to be in the "Technical / Invoice Intrastat Transaction Details"
group. Go to the "Intrastat transaction details" tab and press
**Compute**
Loading

0 comments on commit ef41f02

Please sign in to comment.