Commit 7359d92d by Damien Moulard

prevent registering multiple product supplier shortage

parent 0465b134
Pipeline #888 passed with stage
in 21 seconds
...@@ -108,6 +108,16 @@ class CagetteProduct(models.Model): ...@@ -108,6 +108,16 @@ class CagetteProduct(models.Model):
def register_start_supplier_shortage(product_id, partner_id, date_start): def register_start_supplier_shortage(product_id, partner_id, date_start):
"""Start a supplier shortage for a product""" """Start a supplier shortage for a product"""
api = OdooAPI() api = OdooAPI()
c = [['product_id', '=', product_id],
['partner_id', '=', partner_id],
['date_start', '=', date_start]]
existing = api.search_read('product.supplier.shortage', c)
if existing:
res = "already on shortage"
return res
f = { f = {
'product_id' : product_id, 'product_id' : product_id,
'partner_id' : partner_id, 'partner_id' : partner_id,
......
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