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