prevent duplicat staff
parent
210ddcc5a8
commit
e3a75860ea
|
@ -28,6 +28,9 @@ class Migration(migration.Migration):
|
|||
for hdcase in get_model("clinic.hd.case").search_browse(dom):
|
||||
if not hdcase.pickings:
|
||||
print('gen picking for %s in %s'%(hdcase.number, hdcase.date))
|
||||
hdcase.make_pickings()
|
||||
ctx={
|
||||
'migrate':True,
|
||||
}
|
||||
hdcase.make_pickings(context=ctx)
|
||||
|
||||
Migration.register()
|
||||
|
|
|
@ -819,9 +819,12 @@ class HDCase(Model):
|
|||
if patient.type_id.main_product:
|
||||
if len(prod_code)>1:
|
||||
prods=get_model('product').search_browse(['code','=',prod_code])
|
||||
if not prods:
|
||||
raise Exception("Can not create good issue: product code %s is not found!"%prod_code)
|
||||
prod=prods[0]
|
||||
if not context.get('migrate'):
|
||||
if not prods:
|
||||
raise Exception("Can not create goods issue: product code %s is not found!"%prod_code)
|
||||
prod=prods[0]
|
||||
else:
|
||||
continue
|
||||
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
|
||||
continue
|
||||
prod_exist_ids.append(prod.id)
|
||||
|
|
|
@ -203,6 +203,9 @@ class Visit(Model):
|
|||
hd_case_id=None
|
||||
if obj.hd_cases:
|
||||
hd_case=obj.hd_cases[0]
|
||||
# prevent duplicate staff: del old staff
|
||||
for staff in hd_case.staffs:
|
||||
staff.delete()
|
||||
hd_case.write(vals)
|
||||
hd_case_id=hd_case.id
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue