prevent forgot enter doctor in hdcase
parent
c68c521922
commit
b79cfd015e
|
@ -99,7 +99,7 @@
|
||||||
<field name="staffs" nolabel="1">
|
<field name="staffs" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<!--<field name="type" invisible="1"/>-->
|
<!--<field name="type" invisible="1"/>-->
|
||||||
<field name="staff_id" domain="[['type','=','doctor']]"/>
|
<field name="staff_id" onchange="onchange_staff" domain="[['type','=','doctor']]"/>
|
||||||
<field name="priop"/>
|
<field name="priop"/>
|
||||||
<field name="note"/>
|
<field name="note"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -101,6 +101,7 @@ class HDCase(Model):
|
||||||
lab=0
|
lab=0
|
||||||
misc=0
|
misc=0
|
||||||
dlz_price=0
|
dlz_price=0
|
||||||
|
srv=0
|
||||||
mdc=0
|
mdc=0
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
amt=line.amount or 0
|
amt=line.amount or 0
|
||||||
|
@ -122,7 +123,6 @@ class HDCase(Model):
|
||||||
else:
|
else:
|
||||||
mdc+=amt
|
mdc+=amt
|
||||||
mdc_names.append(name or "")
|
mdc_names.append(name or "")
|
||||||
continue #XXX
|
|
||||||
if categ.code=='EPO':
|
if categ.code=='EPO':
|
||||||
name=prod.name or ""
|
name=prod.name or ""
|
||||||
name=name.split("-")
|
name=name.split("-")
|
||||||
|
@ -133,6 +133,8 @@ class HDCase(Model):
|
||||||
fee+=amt*sign
|
fee+=amt*sign
|
||||||
elif categ.code=='DLZ':
|
elif categ.code=='DLZ':
|
||||||
dlz_price+=amt
|
dlz_price+=amt
|
||||||
|
elif categ.code=='SRV':
|
||||||
|
dlz_price+=amt
|
||||||
elif categ.code=="LAB":
|
elif categ.code=="LAB":
|
||||||
if reimbursable_ctx:
|
if reimbursable_ctx:
|
||||||
if reimbursable_ctx==line.reimbursable:
|
if reimbursable_ctx==line.reimbursable:
|
||||||
|
@ -151,6 +153,7 @@ class HDCase(Model):
|
||||||
'lab': lab,
|
'lab': lab,
|
||||||
'misc': misc,
|
'misc': misc,
|
||||||
'mdc': mdc,
|
'mdc': mdc,
|
||||||
|
'srv': srv,
|
||||||
'mdc_name': ','.join([n for n in mdc_names]),
|
'mdc_name': ','.join([n for n in mdc_names]),
|
||||||
'dlz_id': dlz_id,
|
'dlz_id': dlz_id,
|
||||||
'dlz_price': dlz_price,
|
'dlz_price': dlz_price,
|
||||||
|
@ -207,6 +210,7 @@ class HDCase(Model):
|
||||||
"dlz_max": fields.Float("DZ Max",function="_get_expense",function_multi=True),
|
"dlz_max": fields.Float("DZ Max",function="_get_expense",function_multi=True),
|
||||||
"dlz_id": fields.Integer("DZ ID",function="_get_expense",function_multi=True),
|
"dlz_id": fields.Integer("DZ ID",function="_get_expense",function_multi=True),
|
||||||
"mdc": fields.Float("MDC",function="_get_expense",function_multi=True),
|
"mdc": fields.Float("MDC",function="_get_expense",function_multi=True),
|
||||||
|
"srv": fields.Float("Service",function="_get_expense",function_multi=True),
|
||||||
"mdc_name": fields.Float("MDC Name",function="_get_expense",function_multi=True),
|
"mdc_name": fields.Float("MDC Name",function="_get_expense",function_multi=True),
|
||||||
'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
|
'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
|
||||||
"ref": fields.Char("Ref",search=True),
|
"ref": fields.Char("Ref",search=True),
|
||||||
|
@ -1084,6 +1088,12 @@ class HDCase(Model):
|
||||||
|
|
||||||
def done(self,ids,context={}):
|
def done(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
count=0
|
||||||
|
for sline in obj.staffs:
|
||||||
|
if sline.staff_id:
|
||||||
|
count+=1
|
||||||
|
if not count:
|
||||||
|
raise Exception("Please define doctor for patient %s"%obj.patient_id.name)
|
||||||
obj.update_usetime()
|
obj.update_usetime()
|
||||||
#FIXME allow user to write sickbed status
|
#FIXME allow user to write sickbed status
|
||||||
user_id=get_active_user()
|
user_id=get_active_user()
|
||||||
|
@ -1486,6 +1496,8 @@ class HDCase(Model):
|
||||||
st[staff.id]=1
|
st[staff.id]=1
|
||||||
else:
|
else:
|
||||||
raise Exception("Douplicate %s"%staff.name)
|
raise Exception("Douplicate %s"%staff.name)
|
||||||
|
if not st:
|
||||||
|
raise Exception("Please define doctor!")
|
||||||
self.check_hct(obj)
|
self.check_hct(obj)
|
||||||
|
|
||||||
def approve(self,ids,context={}):
|
def approve(self,ids,context={}):
|
||||||
|
@ -1557,5 +1569,13 @@ class HDCase(Model):
|
||||||
},
|
},
|
||||||
'flash': '%s is droped'%dlz.number,
|
'flash': '%s is droped'%dlz.number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def onchange_staff(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
path=context['path']
|
||||||
|
line=get_data_path(data,path,parent=True)
|
||||||
|
if not line.get('priop'):
|
||||||
|
line['priop']='owner'
|
||||||
|
return data
|
||||||
|
|
||||||
HDCase.register()
|
HDCase.register()
|
||||||
|
|
Loading…
Reference in New Issue