diff --git a/intrastat_product/README.rst b/intrastat_product/README.rst index 927269a..36c8e3f 100644 --- a/intrastat_product/README.rst +++ b/intrastat_product/README.rst @@ -53,6 +53,12 @@ Installation This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise. +We recommended to install the module **product_net_weight** from +``OCA/product-attribute ``\ \_. +If this module is installed, Odoo will use the *Net Weight* field of the +product to compute the intrastat declaration instead of the native +*Weight* field. + Configuration ============= diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index 70925a1..b53c7a0 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -363,7 +363,12 @@ class IntrastatProductDeclaration(models.Model): elif source_uom.category_id == product.uom_id.category_id: # We suppose that, on product.template, # the 'weight' field is per uom_id - weight = product.weight * source_uom._compute_quantity( + # Test if module product_net_weight from OCA/product-attribute is installed + if hasattr(product, "net_weight"): + product_weight = product.net_weight + else: + product_weight = product.weight + weight = product_weight * source_uom._compute_quantity( line_qty, product.uom_id ) else: diff --git a/intrastat_product/readme/INSTALL.md b/intrastat_product/readme/INSTALL.md index 2227115..7a0d5e2 100644 --- a/intrastat_product/readme/INSTALL.md +++ b/intrastat_product/readme/INSTALL.md @@ -1,2 +1,4 @@ This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise. + +We recommended to install the module **product_net_weight** from `OCA/product-attribute `_. If this module is installed, Odoo will use the *Net Weight* field of the product to compute the intrastat declaration instead of the native *Weight* field. diff --git a/intrastat_product/static/description/index.html b/intrastat_product/static/description/index.html index 913b17d..8f1c6c8 100644 --- a/intrastat_product/static/description/index.html +++ b/intrastat_product/static/description/index.html @@ -402,6 +402,11 @@ those countries.

Installation

This module is NOT compatible with the account_intrastat module from Odoo Enterprise.

+

We recommended to install the module product_net_weight from +OCA/product-attribute <https://github.com/OCA/product-attribute>_. +If this module is installed, Odoo will use the Net Weight field of the +product to compute the intrastat declaration instead of the native +Weight field.