Commit dd73be81 by François

Add sigma and void percent days in products data

parent e2b7efce
...@@ -506,8 +506,12 @@ class CagetteProducts(models.Model): ...@@ -506,8 +506,12 @@ class CagetteProducts(models.Model):
products_t = api.search_read('product.template', c, f) 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"] 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_average_params = {'ids': ptids,
# sales = CagetteProducts.get_template_products_sales_average({'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: if 'list' in sales and len(sales['list']) > 0:
sales = sales['list'] sales = sales['list']
else: else:
...@@ -525,9 +529,8 @@ class CagetteProducts(models.Model): ...@@ -525,9 +529,8 @@ class CagetteProducts(models.Model):
for s in sales: for s in sales:
if s["id"] == fp["id"]: if s["id"] == fp["id"]:
filtered_products_t[i]['daily_conso'] = s["average_qty"] filtered_products_t[i]['daily_conso'] = s["average_qty"]
filtered_products_t[i]['sigma'] = s["sigma"]
if not 'daily_conso' in filtered_products_t[i]: filtered_products_t[i]['vpc'] = s["vpc"]
filtered_products_t[i]['daily_conso'] = 0
res["products"] = filtered_products_t res["products"] = filtered_products_t
except Exception as e: 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