[FIX] report_intrastat: product weight

- Create a product with 2 variants A & B
- Set a weight on the variants (btw, the weight field is not available
  on the template in this case)
- Create an invoice for A, validate

On the intrastat report, the weight remains 0.0.

The report clearly takes into account the weight of the template, not of
the variant. We use the product weight, and fall back on the template
weight.

opw-1913305

closes odoo/odoo#29178
This commit is contained in:
Nicolas Martinelli
2018-11-30 09:55:38 +00:00
parent 80a11ca27d
commit ae4a4cf0a9
@@ -40,8 +40,8 @@ class ReportIntrastat(models.Model):
else 0
end) as value,
sum(
case when uom.category_id != puom.category_id then (pt.weight * inv_line.quantity)
else (pt.weight * inv_line.quantity * uom.factor) end
case when uom.category_id != puom.category_id then (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity)
else (coalesce(nullif(pp.weight, 0), pt.weight) * inv_line.quantity * uom.factor) end
) as weight,
sum(
case when uom.category_id != puom.category_id then inv_line.quantity