Commit 1f24de45 by Yvon Kerdoncuff

properly control return value of action_validate

parent 21bdf00e
Pipeline #3904 canceled with stage
...@@ -417,10 +417,10 @@ class CagetteInventory(models.Model): ...@@ -417,10 +417,10 @@ class CagetteInventory(models.Model):
# Set inventory as 'done' even if some products missed # Set inventory as 'done' even if some products missed
res = api.execute('stock.inventory', 'action_validate', [inv]) res = api.execute('stock.inventory', 'action_validate', [inv])
if res is True: if res is None:
done.append('Closed inventory') done.append('Closed inventory')
else: else:
action_validate_issue = "Action validate did not return True." action_validate_issue = "Action validate did not return None."
coop_logger.error(action_validate_issue) coop_logger.error(action_validate_issue)
errors.append(action_validate_issue) errors.append(action_validate_issue)
if isinstance(res, dict) and 'name' in res: if isinstance(res, dict) and 'name' in res:
...@@ -433,7 +433,6 @@ class CagetteInventory(models.Model): ...@@ -433,7 +433,6 @@ class CagetteInventory(models.Model):
else: #well, in that case, just try to print the value returned by res to help debugging... else: #well, in that case, just try to print the value returned by res to help debugging...
coop_logger.error(res) coop_logger.error(res)
errors.append(res) errors.append(res)
done.append('Closed inventory')
except Exception as e: except Exception as e:
if not (MARSHALL_ERROR in str(e)): if not (MARSHALL_ERROR in str(e)):
coop_logger.error("update_stock_with_shelf_inventory_data %s",str(e)) coop_logger.error("update_stock_with_shelf_inventory_data %s",str(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