fix
parent
e5cd180a9c
commit
62c044f070
|
@ -103,6 +103,15 @@ class CycleItem(Model):
|
||||||
|
|
||||||
def validate(self,ids,context={}):
|
def validate(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
#prevent duplicate nurse
|
||||||
|
ns={}
|
||||||
|
for line in obj.lines:
|
||||||
|
nurse=line.nurse_id
|
||||||
|
if not ns.get(nurse.id):
|
||||||
|
ns[nurse.id]=1
|
||||||
|
else:
|
||||||
|
raise Exception("Duplicate %s"%nurse.name)
|
||||||
|
|
||||||
for hdcase in obj.hd_cases:
|
for hdcase in obj.hd_cases:
|
||||||
state=hdcase.state
|
state=hdcase.state
|
||||||
if state=='cancelled':
|
if state=='cancelled':
|
||||||
|
|
|
@ -1475,6 +1475,16 @@ class HDCase(Model):
|
||||||
self.function_store(ids)
|
self.function_store(ids)
|
||||||
super().write(ids,vals,**kw)
|
super().write(ids,vals,**kw)
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
# prevent duplicate doctor
|
||||||
|
print('obj.state ', obj.state)
|
||||||
|
if obj.state in ('waiting_payment', 'paid'):
|
||||||
|
st={}
|
||||||
|
for lstaff in obj.staffs:
|
||||||
|
staff=lstaff.staff_id
|
||||||
|
if not st.get(staff.id):
|
||||||
|
st[staff.id]=1
|
||||||
|
else:
|
||||||
|
raise Exception("Douplicate %s"%staff.name)
|
||||||
self.check_hct(obj)
|
self.check_hct(obj)
|
||||||
|
|
||||||
def approve(self,ids,context={}):
|
def approve(self,ids,context={}):
|
||||||
|
|
|
@ -311,18 +311,19 @@ class LaborCost(Model):
|
||||||
if hd_case.state not in ('waiting_payment','paid'):
|
if hd_case.state not in ('waiting_payment','paid'):
|
||||||
continue
|
continue
|
||||||
staffs=hd_case.staffs
|
staffs=hd_case.staffs
|
||||||
if not staffs and dwalkin:
|
doctor_id=hd_case.doctor_id
|
||||||
staff=dwalkin
|
if not doctor_id and dwalkin:
|
||||||
staff_total[staff.id]={
|
if not staff_total.get(dwalkin.id):
|
||||||
|
staff_total[dwalkin.id]={
|
||||||
'base': 0,
|
'base': 0,
|
||||||
'type': staff.type,
|
'type': dwalkin.type,
|
||||||
'categ_id': staff.categ_id.id,
|
'categ_id': dwalkin.categ_id.id,
|
||||||
'level_id': staff.level_id.id,
|
'level_id': dwalkin.level_id.id,
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
}
|
}
|
||||||
base=cost_per_case
|
base=cost_per_case
|
||||||
staff_total[staff.id]['base']=base
|
staff_total[dwalkin.id]['base']=base
|
||||||
staff_total[staff.id]['qty']+=1
|
staff_total[dwalkin.id]['qty']+=1
|
||||||
else:
|
else:
|
||||||
for ps in staffs:
|
for ps in staffs:
|
||||||
staff=ps.staff_id or dwalkin
|
staff=ps.staff_id or dwalkin
|
||||||
|
|
|
@ -313,7 +313,7 @@ class MatchingHDCase(Model):
|
||||||
if date_from==date_to:
|
if date_from==date_to:
|
||||||
date=date_from
|
date=date_from
|
||||||
data={
|
data={
|
||||||
'lines': lines,
|
'lines': sorted(lines,key=lambda x: x.get('date')),
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
'date_to': date_to,
|
'date_to': date_to,
|
||||||
'date': date,
|
'date': date,
|
||||||
|
|
|
@ -187,6 +187,7 @@ class ReportLaborCost(Model):
|
||||||
'branch_id': department.branch_id.id,
|
'branch_id': department.branch_id.id,
|
||||||
}
|
}
|
||||||
for hdcase in citem.hd_cases:
|
for hdcase in citem.hd_cases:
|
||||||
|
if hdcase.state in ('waiting_payment','paid'):
|
||||||
ndata[dpt_name]['hdcases'].update({hdcase.id})
|
ndata[dpt_name]['hdcases'].update({hdcase.id})
|
||||||
total_amount=0
|
total_amount=0
|
||||||
for categ_name,vals in ctdata.items():
|
for categ_name,vals in ctdata.items():
|
||||||
|
|
|
@ -56,8 +56,9 @@ class ReportThaiWHTCertif(Model):
|
||||||
else:
|
else:
|
||||||
if contact_type!=comp.contact_type:
|
if contact_type!=comp.contact_type:
|
||||||
raise Exception("Different WHT contact types for same payment")
|
raise Exception("Different WHT contact types for same payment")
|
||||||
print('sequence ', comp.sequence)
|
|
||||||
exp_code=comp.sequence or "5"
|
exp_code=comp.sequence or "5"
|
||||||
|
exp_code=exp_code.replace(".","_")
|
||||||
|
print('sequence ', exp_code)
|
||||||
#if comp.exp_type=="salary":
|
#if comp.exp_type=="salary":
|
||||||
#exp_code="1"
|
#exp_code="1"
|
||||||
#elif comp.exp_type=="commission":
|
#elif comp.exp_type=="commission":
|
||||||
|
|
Loading…
Reference in New Issue