Commit dd73be81 by François

Add sigma and void percent days in products data

parent e2b7efce
......@@ -506,8 +506,12 @@ class CagetteProducts(models.Model):
products_t = api.search_read('product.template', c, f)
filtered_products_t = [p for p in products_t if p["state"] != "end" and p["state"] != "obsolete"]
sales = CagetteProducts.get_template_products_sales_average({'ids': ptids, 'from': '2019-06-10', 'to': '2020-08-10'})
# sales = CagetteProducts.get_template_products_sales_average({'ids': ptids})
sales_average_params = {'ids': ptids,
#'from': '2019-06-10',
#'to': '2019-08-10',
}
sales = CagetteProducts.get_template_products_sales_average(sales_average_params)
if 'list' in sales and len(sales['list']) > 0:
sales = sales['list']
else:
......@@ -525,9 +529,8 @@ class CagetteProducts(models.Model):
for s in sales:
if s["id"] == fp["id"]:
filtered_products_t[i]['daily_conso'] = s["average_qty"]
if not 'daily_conso' in filtered_products_t[i]:
filtered_products_t[i]['daily_conso'] = 0
filtered_products_t[i]['sigma'] = s["sigma"]
filtered_products_t[i]['vpc'] = s["vpc"]
res["products"] = filtered_products_t
except Exception as e:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment