Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion intrastat_product/models/intrastat_product_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _get_weight_and_supplunits(self, inv_line, hs_code, notedict):
source_uom = inv_line.product_uom_id
weight_uom_categ = self.env.ref("uom.product_uom_categ_kgm")
kg_uom = self.env.ref("uom.product_uom_kgm")
self.env["decimal.precision"].precision_get("Stock Weight")
weight_prec = self.env["decimal.precision"].precision_get("Stock Weight")
weight = suppl_unit_qty = 0.0

if not source_uom:
Expand Down Expand Up @@ -436,8 +436,20 @@ def _get_weight_and_supplunits(self, inv_line, hs_code, notedict):
# Test if module product_net_weight from OCA/product-attribute is installed
if hasattr(product, "net_weight"):
product_weight = product.net_weight
if float_is_zero(product_weight, precision_digits=weight_prec):
msg = _(
"Net weight is not set on product '%s'.", product.display_name
)
notedict["product"][product.display_name][msg].add(
notedict["invline_origin"]
)
else:
product_weight = product.weight
if float_is_zero(product_weight, precision_digits=weight_prec):
msg = _("Weight is not set on product '%s'.", product.display_name)
notedict["product"][product.display_name][msg].add(
notedict["invline_origin"]
)
weight = product_weight * source_uom._compute_quantity(
line_qty, product.uom_id
)
Expand Down
Loading