From ae4a4cf0a9d3fb0a9590494b255bda0176e5cc0a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 30 Nov 2018 09:55:38 +0000 Subject: [PATCH] [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 --- addons/report_intrastat/report/report_intrastat_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/report_intrastat/report/report_intrastat_report.py b/addons/report_intrastat/report/report_intrastat_report.py index 3ff63b4a4f6..1ca5dfb4bec 100644 --- a/addons/report_intrastat/report/report_intrastat_report.py +++ b/addons/report_intrastat/report/report_intrastat_report.py @@ -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