From 2c3f578cc611095095326e07ac0e889706a43369 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Fri, 12 Jun 2015 14:38:26 +0700 Subject: [PATCH] improve report --- netforce_clinic/models/patient.py | 5 ++++- netforce_clinic/models/report_cycle_setting.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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,