improve dialyzer
parent
58ec5de459
commit
10b2578088
|
@ -3,7 +3,7 @@
|
|||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,in_progress,waiting_treatment"/>
|
||||
<item string="RD Shop" method="new_shop" states="draft,in_progress,waiting_treatment"/>
|
||||
<!--<item string="RD Shop" method="new_shop" states="draft,in_progress,waiting_treatment"/>-->
|
||||
<item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
|
||||
</button>
|
||||
</head>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<field name="membrane_type" span="2"/>
|
||||
<field name="dialyzer_type" span="2"/>
|
||||
<field name="use_time"/>
|
||||
<field name="max_use_time" readonly="1"/>
|
||||
<field name="max_use_time"/>
|
||||
<field name="description"/>
|
||||
</list>
|
||||
</field>
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
<item string="HD Cases" action="clinic_hd_case"/>
|
||||
<item string="RD Shop" action="clinic_shop" perm="clinic_shop"/>
|
||||
<item string="Sickbed" action="clinic_sickbed"/>
|
||||
<divider/>
|
||||
<header string="OTHERS"/>
|
||||
<item string="Matching HD Case" action="clinic_matching_hd_case"/>
|
||||
</item>
|
||||
<item string="Reporting" perm="clinic_report">
|
||||
<item string="Visit Summary" action="clinic_report_visit"/>
|
||||
|
|
|
@ -215,7 +215,7 @@ class Dialyzer(Model):
|
|||
obj=self.browse(ids[0])
|
||||
# XXX
|
||||
if obj.use_time > obj.max_use_time:
|
||||
raise Exception("No long to use it (use time > max use time")
|
||||
raise Exception("Dialyzer %s is expired. (use time > max use time)"%obj.number or '')
|
||||
obj.cancel()
|
||||
obj.write({"state": "new"})
|
||||
|
||||
|
|
|
@ -153,15 +153,8 @@ class HDCase(Model):
|
|||
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'number': '/',
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
#'wt_start': 0.0,
|
||||
#'wt_stop': 0.0,
|
||||
#'bp_start': '0/0',
|
||||
#'bp_stop': '0/0',
|
||||
#"bid_flow_rate": 0.0,
|
||||
#"ultrafittration": 0.0,
|
||||
'hd_acc': 'o',
|
||||
'hd_mode': 'chronic',
|
||||
#'hct': 0,
|
||||
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
|
||||
'invoice_option': 'fee',
|
||||
'invoice_policy': 'fee',
|
||||
|
@ -686,23 +679,32 @@ class HDCase(Model):
|
|||
for obj in self.browse(ids):
|
||||
is_decrease=context.get('is_decrease')
|
||||
for dlz_line in obj.dialyzers:
|
||||
dlz=dlz_line.dialyzer_id
|
||||
membrane_type=dlz_line.membrane_type or ''
|
||||
dialyzer_type=dlz_line.dialyzer_type or ''
|
||||
use_time=dlz_line.use_time or 0
|
||||
max_use_time=dlz_line.max_use_time or 0
|
||||
desc=dlz_line.description or ''
|
||||
if is_decrease:
|
||||
use_time-=1
|
||||
print("decrease ok")
|
||||
print("use_time ", use_time)
|
||||
if dlz_line.use_time < dlz.max_use_time:
|
||||
dlz.write({
|
||||
'use_time': use_time,
|
||||
})
|
||||
elif dlz_line.use_time==dlz.max_use_time:
|
||||
dlz.write({
|
||||
vals={
|
||||
'membrane_type': membrane_type,
|
||||
'dialyzer_type': dialyzer_type,
|
||||
'use_time': use_time,
|
||||
'max_use_time': max_use_time,
|
||||
'note': desc,
|
||||
}
|
||||
if use_time==max_use_time:
|
||||
vals.update({
|
||||
'use_time': use_time,
|
||||
'state': 'expire',
|
||||
})
|
||||
else:
|
||||
elif use_time > max_use_time:
|
||||
raise Exception("Dialyzer is expired!")
|
||||
else:
|
||||
pass
|
||||
dlz=dlz_line.dialyzer_id
|
||||
dlz.write(vals)
|
||||
return True
|
||||
|
||||
def create_cycle_item(self,ids,context={}):
|
||||
|
@ -993,6 +995,7 @@ class HDCase(Model):
|
|||
'use_time': 1,
|
||||
'max_use_time': dialyzer.max_use_time,
|
||||
'dialyzer_type': dialyzer.dialyzer_type,
|
||||
'membrane_type': dialyzer.membrane_type,
|
||||
}))
|
||||
obj.write(vals)
|
||||
if context.get('called'):
|
||||
|
|
|
@ -19,7 +19,7 @@ class HDCaseDialyzerLine(Model):
|
|||
"description": fields.Char("Description",search=True),
|
||||
"use_time":fields.Integer("Use time"),
|
||||
"max_use_time":fields.Integer("Max use time"),
|
||||
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type",function="_get_all",function_multi=True),
|
||||
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
||||
}
|
||||
|
||||
HDCaseDialyzerLine.register()
|
||||
|
|
|
@ -136,11 +136,12 @@ class Visit(Model):
|
|||
dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
|
||||
use_time+=1
|
||||
vals={
|
||||
"description": dialyzer.name or dialyzer.product_id.name or "",
|
||||
'dialyzer_id': dialyzer.id,
|
||||
'membrane_type': dialyzer.membrane_type or '',
|
||||
"dialyzer_type": dialyzer.dialyzer_type,
|
||||
"use_time": use_time,
|
||||
"max_use_time": dialyzer.max_use_time,
|
||||
"dialyzer_type": dialyzer.dialyzer_type,
|
||||
'dialyzer_id': dialyzer.id,
|
||||
"description": dialyzer.name or dialyzer.product_id.name or "",
|
||||
}
|
||||
return vals
|
||||
|
||||
|
|
Loading…
Reference in New Issue