Commit 58fea6af by François C.

Fix error if inventory custom list products has no shelf

parent aa44fc84
Pipeline #2350 passed with stage
in 1 minute 27 seconds
......@@ -90,16 +90,19 @@ class CagetteInventory(models.Model):
p[k] = ''
# Get shelf sortorder
if p['shelf_id'] is not False:
if p['shelf_id'] is not False and len(p['shelf_id']) > 0:
c = [['id', '=', p['shelf_id'][0]]]
f = ['id', 'sort_order']
res_sortorder = api.search_read('product.shelfs', c, f)
if res_sortorder:
p['shelf_sortorder'] = res_sortorder[0]['sort_order']
else:
p['shelf_sortorder'] = ''
res['data'] = pdts
except Exception as e:
coop_logger.error("get_custom_list_products -> Erreur lors de la récupération des produits : %s", str(e))
res['error'] = "Erreur lors de la récupération des produits (" + str(e) + ")"
return res
......
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