diff --git a/netforce_clinic/models/patient_cycle.py b/netforce_clinic/models/patient_cycle.py index 85886df..9e11139 100644 --- a/netforce_clinic/models/patient_cycle.py +++ b/netforce_clinic/models/patient_cycle.py @@ -3,6 +3,7 @@ from netforce.model import Model, fields class PatientCycle(Model): _name="clinic.patient.cycle" _string="Patient Cycle" + _audit_log=True _fields={ "patient_id": fields.Many2One('clinic.patient',"Patient",required=True,on_delete="cascade",search=True,domain=[['state','=','admit']]), diff --git a/netforce_clinic/models/visit_popup_confirm.py b/netforce_clinic/models/visit_popup_confirm.py index f1ea43d..950bdf7 100644 --- a/netforce_clinic/models/visit_popup_confirm.py +++ b/netforce_clinic/models/visit_popup_confirm.py @@ -87,13 +87,18 @@ class VisitPopupConfirm(Model): obj=self.browse(ids)[0] board=obj.visitboard_id count=0 + + user_id=get_active_user() + nurse_ids=get_model("clinic.staff").search([['user_id','=',user_id],['type','=','nurse']]) + vals={} + if nurse_ids: + vals['nurse_id']=nurse_ids[0] for line in obj.lines: vs=line.visit_id dt=line.doctor_id if dt: - vs.write({ - 'doctor_id': dt.id, - }) + vals['doctor_id']=dt.id + vs.write(vals) vs.confirm() count+=1 return {