prepare merge patient

conv_bal
watcha.h 2015-04-27 18:02:21 +07:00
parent 1c16736a0f
commit 19e47b6b38
3 changed files with 23 additions and 15 deletions

View File

@ -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)

View File

@ -1,2 +1,4 @@
- location
- staff , patient should be main
- staff
- patient

View File

@ -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