Commit 8b25f8a3 by Damien Moulard

fix add one product

parent da96a62e
Pipeline #1141 passed with stage
in 1 minute 21 seconds
......@@ -468,7 +468,7 @@ class CagetteProducts(models.Model):
try:
today = datetime.date.today().strftime("%Y-%m-%d")
if len(supplier_ids) > 0:
if supplier_ids is not None and len(supplier_ids) > 0:
# Get products/supplier relation
f = ["product_tmpl_id", 'date_start', 'date_end', 'package_qty', 'price', 'name']
c = [['name', 'in', [ int(x) for x in supplier_ids]]]
......@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params = {
'ids': ptids,
'from': '2019-04-10',
'to': '2019-08-10',
# 'from': '2019-04-10',
# 'to': '2019-08-10',
}
sales = CagetteProducts.get_template_products_sales_average(sales_average_params)
......@@ -515,7 +515,7 @@ class CagetteProducts(models.Model):
# Add supplier data to product data
for i, fp in enumerate(filtered_products_t):
if len(supplier_ids) > 0:
if supplier_ids is not None and len(supplier_ids) > 0:
psi_item = next(item for item in psi if item["product_tmpl_id"] is not False and item["product_tmpl_id"][0] == fp["id"])
filtered_products_t[i]['suppliersinfo'] = [{
'supplier_id': int(psi_item["name"][0]),
......
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