From 19e47b6b38a8582f84d1753bd59300693015deef Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 27 Apr 2015 18:02:21 +0700 Subject: [PATCH] prepare merge patient --- netforce_clinic/models/setting.py | 18 +++++++++++++++++- netforce_clinic/readme.txt | 4 +++- netforce_clinic/todo.txt | 16 +++------------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index d93798c..eba1b38 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -157,6 +157,15 @@ class ClinicSetting(Model): }) def run_script(self,ids,context={}): + user_id=get_active_user() + if user_id !=1: + print("Only admin!!") + return + obj=self.browse(ids)[0] + obj.del_duplicate_staff() + print("Done!") + + def del_duplicate_staff(self,ids,context={}): user_id=get_active_user() if user_id !=1: print("Only admin!!") @@ -173,6 +182,14 @@ class ClinicSetting(Model): 'branch_id': pt.department_id.id, }) sts={} + print('='*50, 'patients duplicate') + for pt, vals in pts.items(): + vals=sorted(vals,key=lambda x: x['date']) + count=len(vals) + if count > 1: + print(vals) + + print('='*50, 'staffs duplicate') for st in get_model("clinic.staff").search_browse([]): name='%s %s'%(st.first_name or '', st.last_name or '') if not sts.get(name): @@ -185,7 +202,6 @@ class ClinicSetting(Model): 'date': st.date, }) - print('='*50, 'staffs duplicate') for st, vals in sts.items(): vals=sorted(vals,key=lambda x: x['date']) count=len(vals) diff --git a/netforce_clinic/readme.txt b/netforce_clinic/readme.txt index f74baae..1c0929d 100644 --- a/netforce_clinic/readme.txt +++ b/netforce_clinic/readme.txt @@ -1,2 +1,4 @@ - location - - staff , patient should be main + - staff + - patient + diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 9495a53..af7635a 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,15 +1,5 @@ > script: - merge staff, patient - source => destination - - step: - > patient: - 1. copy: - - properties - - visit - - hdcases - - dialyzers - 2. delete old one - > staff: - -> invoice payment on rd shop + - merge + - staff -> ok + - patient