From 1e22870d2628e8b8019e8c499b96c8652f5bdfc4 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 29 Dec 2016 14:53:48 +0100 Subject: [PATCH] [FIX] product_margin: crash of read_group Introduced by 9a479e657202c --- addons/product_margin/models/product_product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product_margin/models/product_product.py b/addons/product_margin/models/product_product.py index 64ae6c4f7a6..6b9d71287d7 100644 --- a/addons/product_margin/models/product_product.py +++ b/addons/product_margin/models/product_product.py @@ -50,7 +50,7 @@ class ProductProduct(models.Model): """ Inherit read_group to calculate the sum of the non-stored fields, as it is not automatically done anymore through the XML. """ - res = super(ProductProduct, self).read_group(fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy) + res = super(ProductProduct, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy) fields_list = ['turnover', 'sale_avg_price', 'sale_purchase_price', 'sale_num_invoiced', 'purchase_num_invoiced', 'sales_gap', 'purchase_gap', 'total_cost', 'sale_expected', 'normal_cost', 'total_margin', 'expected_margin', 'total_margin_rate', 'expected_margin_rate'] @@ -66,7 +66,7 @@ class ProductProduct(models.Model): for prod in products: prod_re[prod] = re_ind re_ind += 1 - res_val = tot_products._compute_product_margin_fields_values([x for x in fields if fields in fields_list], '') + res_val = tot_products._compute_product_margin_fields_values(field_names=[x for x in fields if fields in fields_list]) for key in res_val.keys(): for l in res_val[key].keys(): re = res[prod_re[key]]