Skip to content

Commit

Permalink
Merge PR OCA#4061 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by sergiocorato
  • Loading branch information
OCA-git-bot committed Mar 21, 2024
2 parents f72b8a4 + b9b0721 commit 23b0b49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions l10n_it_intrastat/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _prepare_intrastat_line(self):
self._prepare_intrastat_line_amount(res)

# Weight
weight_kg = self._prepare_intrastat_line_weight(product_template, res)
weight_kg = self._prepare_intrastat_line_weight(self.product_id, res)

# Additional Units
self._prepare_intrastat_line_additional_units(
Expand Down Expand Up @@ -217,16 +217,16 @@ def _prepare_intrastat_line_additional_units(
additional_units = self.quantity
res.update({"additional_units": additional_units})

def _prepare_intrastat_line_weight(self, product_template, res):
def _prepare_intrastat_line_weight(self, product, res):
self.ensure_one()
intrastat_uom_kg = self.move_id.company_id.intrastat_uom_kg_id
# ...Weight compute in Kg
# ...If Uom has the same category of kg -> Convert to Kg
# ...Else the weight will be product weight * qty
product_weight = product_template.weight or 0
product_weight = product.weight or 0
if (
intrastat_uom_kg
and product_template.uom_id.category_id == intrastat_uom_kg.category_id
and product.uom_id.category_id == intrastat_uom_kg.category_id
):
weight_kg = self.product_uom_id._compute_quantity(
qty=self.quantity, to_unit=intrastat_uom_kg
Expand Down

0 comments on commit 23b0b49

Please sign in to comment.