From d91c0a2013eeb58e837e2a8405190d7d2ca699b5 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 4 Jun 2018 13:27:16 +0200 Subject: [PATCH] [FIX] sale: Number of SO linked to an archived article When archiving a product template P with one SO linked to it, - Going to P by Accounting > Configuration > Products > P shows 1 sale in smart button - Going to P by Accounting > Sellable products > P showed 0 sale in smart button Now it shows 1 sale in these two cases. opw:1852948 --- addons/sale/models/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/product_template.py b/addons/sale/models/product_template.py index 6d51984b51e..38a158948f5 100644 --- a/addons/sale/models/product_template.py +++ b/addons/sale/models/product_template.py @@ -24,7 +24,7 @@ class ProductTemplate(models.Model): @api.depends('product_variant_ids.sales_count') def _sales_count(self): for product in self: - product.sales_count = sum([p.sales_count for p in product.product_variant_ids]) + product.sales_count = sum([p.sales_count for p in product.with_context(active_test=False).product_variant_ids]) @api.multi def action_view_sales(self):