order by name
parent
a3d621bfcf
commit
7e652ab9b5
|
@ -145,6 +145,7 @@ class ReportLaborCostSummary(Model):
|
||||||
if not staffs.get(staff.name):
|
if not staffs.get(staff.name):
|
||||||
staffs[staff.name]={
|
staffs[staff.name]={
|
||||||
'number': staff.number or '',
|
'number': staff.number or '',
|
||||||
|
'first_name': staff.first_name or "",
|
||||||
'staff_id': staff.id,
|
'staff_id': staff.id,
|
||||||
'staff_type': staff.type,
|
'staff_type': staff.type,
|
||||||
'staff_level': level_name,
|
'staff_level': level_name,
|
||||||
|
@ -184,6 +185,7 @@ class ReportLaborCostSummary(Model):
|
||||||
for sname in snames:
|
for sname in snames:
|
||||||
vals=staffs[sname]
|
vals=staffs[sname]
|
||||||
lvals={
|
lvals={
|
||||||
|
'first_name': vals.get("first_name") or "",
|
||||||
'staff_name': sname,
|
'staff_name': sname,
|
||||||
'staff_id': vals.get('staff_id'),
|
'staff_id': vals.get('staff_id'),
|
||||||
'staff_type': vals.get('staff_type'),
|
'staff_type': vals.get('staff_type'),
|
||||||
|
@ -250,7 +252,7 @@ class ReportLaborCostSummary(Model):
|
||||||
# run no
|
# run no
|
||||||
nlines=[]
|
nlines=[]
|
||||||
no=1
|
no=1
|
||||||
for line in sorted(lines, key=lambda x: x['number']):
|
for line in sorted(lines, key=lambda x: (x['staff_name'],x['first_name'])):
|
||||||
line['no']=no
|
line['no']=no
|
||||||
nlines.append(line)
|
nlines.append(line)
|
||||||
no+=1
|
no+=1
|
||||||
|
|
|
@ -161,8 +161,9 @@ class ClinicSetting(Model):
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
#obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
#obj.del_duplicate_staff()
|
#obj.del_duplicate_staff()
|
||||||
|
obj.merge_staff()
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def merge_staff(self,ids,context={}):
|
def merge_staff(self,ids,context={}):
|
||||||
|
@ -171,12 +172,11 @@ class ClinicSetting(Model):
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
sts={}
|
sts={}
|
||||||
print('='*50, 'patients duplicate')
|
|
||||||
db=get_connection()
|
db=get_connection()
|
||||||
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 '')
|
||||||
name=name.replace(" ","")
|
name=name.replace(" ","")
|
||||||
|
name=''.join([n for n in name if n.isalpha()])
|
||||||
if not sts.get(name):
|
if not sts.get(name):
|
||||||
sts[name]=[]
|
sts[name]=[]
|
||||||
sts[name].append({
|
sts[name].append({
|
||||||
|
@ -226,6 +226,8 @@ class ClinicSetting(Model):
|
||||||
res=get_model("clinic.hd.case.staff").search_browse([['staff_id','=',staff_id]])
|
res=get_model("clinic.hd.case.staff").search_browse([['staff_id','=',staff_id]])
|
||||||
if len(res)<=0:
|
if len(res)<=0:
|
||||||
print('doctor zero delete ', st)
|
print('doctor zero delete ', st)
|
||||||
|
for le in get_model("clinic.labor.cost.entry.line").search_browse([['staff_id','=',staff_id]]):
|
||||||
|
le.delete()
|
||||||
get_model('clinic.staff').delete([staff_id])
|
get_model('clinic.staff').delete([staff_id])
|
||||||
else:
|
else:
|
||||||
print('merge doctor... ', st, staff_id, val['date'], val['branch_id'], len(res))
|
print('merge doctor... ', st, staff_id, val['date'], val['branch_id'], len(res))
|
||||||
|
|
Loading…
Reference in New Issue