From 98ec00abb552dc36a76ec3691a65ceec9c60c848 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 3 Mar 2015 10:59:24 +0700 Subject: [PATCH] skip create picking if product type is service --- netforce_clinic/models/dialyzer.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/netforce_clinic/models/dialyzer.py b/netforce_clinic/models/dialyzer.py index 4474f27..0613afe 100644 --- a/netforce_clinic/models/dialyzer.py +++ b/netforce_clinic/models/dialyzer.py @@ -156,22 +156,19 @@ class Dialyzer(Model): raise Exception("Warehouse not found") wh_loc_id=res[0] - line_vals={ - "product_id": prod.id, - "qty": 1, - "uom_id": prod.uom_id.id, - "location_from_id": wh_loc_id, - "location_to_id": cust_loc_id, - } - pick_vals["lines"].append(("create",line_vals)) - if not pick_vals["lines"]: - return { - "flash": "Nothing left to deliver", + if prod.type=='stock': + line_vals={ + "product_id": prod.id, + "qty": 1, + "uom_id": prod.uom_id.id, + "location_from_id": wh_loc_id, + "location_to_id": cust_loc_id, } - picking_obj=get_model("stock.picking") - pick_id=picking_obj.create(pick_vals,context={"pick_type": "out"}) - pick=picking_obj.browse(pick_id) - pick.set_done([pick_id]) + pick_vals["lines"].append(("create",line_vals)) + picking_obj=get_model("stock.picking") + pick_id=picking_obj.create(pick_vals,context={"pick_type": "out"}) + pick=picking_obj.browse(pick_id) + pick.set_done([pick_id]) number=obj.number.replace("/","") if not number: number=self._get_number(context)