diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index e05be52..5a2958d 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -177,6 +177,8 @@ class Patient(Model): 'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walkin"), #'department_names': fields.Text("Departments",function="_get_department_names"), 'location': fields.Char("Location"), #to filter + 'cw_time': fields.DateTime("Cycle Updated"), + 'cw_uid': fields.Many2One("base.user"," Cycle Edit"), } def _get_number(self,context={}): @@ -354,8 +356,9 @@ class Patient(Model): ['manual','=',False], ] visit_ids=get_model("clinic.visit").search(vdom) - print('removing visit .. ', len(visit_ids)) get_model("clinic.visit").delete(visit_ids) + vals['cw_time']=time.strftime("%Y-%m-%d %H:%M:%S") + vals['cw_uid']=get_active_user() if 'type_id' in vals.keys(): #update patient in hd case which state is condition below diff --git a/netforce_clinic/models/report_cycle_setting.py b/netforce_clinic/models/report_cycle_setting.py index 4c85f42..1929938 100644 --- a/netforce_clinic/models/report_cycle_setting.py +++ b/netforce_clinic/models/report_cycle_setting.py @@ -99,9 +99,11 @@ class ReportCycleSetting(Model): continue key=(patient.id,dpt.id) if not pts.get(key): - login=patient.w_uid.login + login='' + if patient.cw_uid: + login=patient.cw_uid.login pts[key]={ - 'w_time': patient.w_time, + 'w_time': patient.cw_time, 'w_uid': login, 'patient_name': patient.name, 'department_name': dpt.name,