create patient.move after patient created

v2
watcha.h 2017-06-10 22:51:39 +07:00
parent 18e88f1ad6
commit 12064ca9b4
1 changed files with 13 additions and 4 deletions

View File

@ -293,9 +293,9 @@ class Patient(Model):
def create(self, vals,**kw):
if 'card_no' in vals.keys():
self.check_idcard(vals.get("card_type",""),vals['card_no'])
obj_id=super().create(vals,**kw)
self.function_store([obj_id])
obj=self.browse(obj_id)
new_id=super().create(vals,**kw)
self.function_store([new_id])
obj=self.browse(new_id)
partner_id=obj.partner_id
if not partner_id:
partner_name='%s %s'%(obj.first_name or "",obj.last_name or "") # XXX
@ -327,7 +327,16 @@ class Patient(Model):
obj.write({
'partner_id': partner_id,
})
return obj_id
########### patient.move
get_model("clinic.patient.move").create({
'patient_id': new_id,
'location_from_id': obj.department_id.id,
'location_to_id': obj.department_id.id,
'state': 'new',
})
###########
return new_id
def delete(self,ids,context={}):
partner_ids=[]