prepare merge patient
parent
1c16736a0f
commit
19e47b6b38
|
@ -157,6 +157,15 @@ class ClinicSetting(Model):
|
||||||
})
|
})
|
||||||
|
|
||||||
def run_script(self,ids,context={}):
|
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()
|
user_id=get_active_user()
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
|
@ -173,6 +182,14 @@ class ClinicSetting(Model):
|
||||||
'branch_id': pt.department_id.id,
|
'branch_id': pt.department_id.id,
|
||||||
})
|
})
|
||||||
sts={}
|
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([]):
|
for st in get_model("clinic.staff").search_browse([]):
|
||||||
name='%s %s'%(st.first_name or '', st.last_name or '')
|
name='%s %s'%(st.first_name or '', st.last_name or '')
|
||||||
if not sts.get(name):
|
if not sts.get(name):
|
||||||
|
@ -185,7 +202,6 @@ class ClinicSetting(Model):
|
||||||
'date': st.date,
|
'date': st.date,
|
||||||
})
|
})
|
||||||
|
|
||||||
print('='*50, 'staffs duplicate')
|
|
||||||
for st, vals in sts.items():
|
for st, vals in sts.items():
|
||||||
vals=sorted(vals,key=lambda x: x['date'])
|
vals=sorted(vals,key=lambda x: x['date'])
|
||||||
count=len(vals)
|
count=len(vals)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
- location
|
- location
|
||||||
- staff , patient should be main
|
- staff
|
||||||
|
- patient
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
> script:
|
> script:
|
||||||
merge staff, patient
|
- merge
|
||||||
source => destination
|
- staff -> ok
|
||||||
- step:
|
- patient
|
||||||
> patient:
|
|
||||||
1. copy:
|
|
||||||
- properties
|
|
||||||
- visit
|
|
||||||
- hdcases
|
|
||||||
- dialyzers
|
|
||||||
2. delete old one
|
|
||||||
> staff:
|
|
||||||
|
|
||||||
> invoice payment on rd shop
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue