when create picking after click button claim expense if product have not parent code then should use that one
parent
99f27424c7
commit
7e5cac82f2
|
@ -814,7 +814,7 @@ class HDCase(Model):
|
||||||
if no_lines:
|
if no_lines:
|
||||||
return
|
return
|
||||||
prod_ids=context.get('prod_ids') or []
|
prod_ids=context.get('prod_ids') or []
|
||||||
prod_exist_ids=[]
|
duplicate_ids=[]
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
if line.state!='draft':
|
if line.state!='draft':
|
||||||
continue
|
continue
|
||||||
|
@ -825,31 +825,28 @@ class HDCase(Model):
|
||||||
continue
|
continue
|
||||||
if not st.dlz_picking_auto and prod.categ_id.code=='DLZ':
|
if not st.dlz_picking_auto and prod.categ_id.code=='DLZ':
|
||||||
continue
|
continue
|
||||||
# check orginal product
|
# looking for master product code if not use the original
|
||||||
prod_code=prod.code.split("-")[0]
|
################## this concept we use
|
||||||
|
# this concept we use for create GI which only 1 product because
|
||||||
|
# 1000
|
||||||
|
# 1000-SSO
|
||||||
|
# 1000-UC
|
||||||
|
# 1000-....
|
||||||
|
# we will combine all this to product code 1000
|
||||||
if patient.type_id.main_product:
|
if patient.type_id.main_product:
|
||||||
if len(prod_code)>1:
|
master_prod_code=prod.code.split("-")[0]
|
||||||
prods=get_model('product').search_browse(['code','=',prod_code])
|
test_ids=get_model('product').search(['code','ilike','%'+master_prod_code+"%"])
|
||||||
|
if len(test_ids)>1:
|
||||||
|
prods=get_model('product').search_browse(['code','=',master_prod_code])
|
||||||
if not context.get('migrate'):
|
if not context.get('migrate'):
|
||||||
if not prods:
|
if not prods:
|
||||||
raise Exception("Can not create goods issue: product code %s is not found!"%prod_code)
|
raise Exception("Can not create goods issue: product code %s is not found!"%master_prod_code)
|
||||||
prod=prods[0]
|
prod=prods[0]
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
|
if prod_ids and prod.id not in prod_ids or prod.id in duplicate_ids:
|
||||||
continue
|
continue
|
||||||
prod_exist_ids.append(prod.id)
|
duplicate_ids.append(prod.id)
|
||||||
dpt_prods=get_model('clinic.department.product').get_location(obj.department_id.id,prod.id)
|
|
||||||
if dpt_prods:
|
|
||||||
wh_loc_id=dpt_prods.get('wh_loc_id')
|
|
||||||
cust_loc_id=dpt_prods.get('cust_loc_id')
|
|
||||||
if not wh_loc_id:
|
|
||||||
wh_loc_id=prod.location_id.id
|
|
||||||
if wh_loc_id:
|
|
||||||
res=get_model("stock.location").search([["type","=","internal"]])
|
|
||||||
if not res:
|
|
||||||
raise Exception("Warehouse not found")
|
|
||||||
wh_loc_id=res[0]
|
|
||||||
line_vals={
|
line_vals={
|
||||||
"product_id": prod.id,
|
"product_id": prod.id,
|
||||||
"qty": line.qty,
|
"qty": line.qty,
|
||||||
|
|
Loading…
Reference in New Issue