update dialyzer from hd case

conv_bal
watcha.h 2015-02-10 13:41:47 +07:00
parent 10b2578088
commit d5e1a43966
3 changed files with 11 additions and 11 deletions

View File

@ -3,6 +3,7 @@
<field name="state"/> <field name="state"/>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
<item string="Copy" method="copy"/> <item string="Copy" method="copy"/>
<item string="To Draft" method="to_draft" states="active"/>
</button> </button>
</head> </head>
<group span="6" columns="1"> <group span="6" columns="1">
@ -12,7 +13,7 @@
<field name="department_id" required="1"/> <field name="department_id" required="1"/>
<field name="date"/> <field name="date"/>
<field name="exp_date"/> <field name="exp_date"/>
<field name="membrane_type"/> <field name="membrane_type" required="1"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<field name="product_id" onchange="onchange_product"/> <field name="product_id" onchange="onchange_product"/>
@ -31,9 +32,8 @@
<!--<separator string="Note: 'Use time' will count automatic after finish HD Case."/>--> <!--<separator string="Note: 'Use time' will count automatic after finish HD Case."/>-->
</group> </group>
<foot> <foot>
<button string="Confirm" type="success" states="new" method="confirm"/> <button string="Validate" type="success" states="new" method="validate"/>
<button string="Drop" type="danger" icon="remove" states="active" method="drop"/> <button string="Drop" type="danger" icon="remove" states="active" method="drop"/>
<button string="Renew" type="primary" icon="refresh" states="active" method="renew"/>
</foot> </foot>
<related> <related>
<field name="pickings" click_action="view_picking"/> <field name="pickings" click_action="view_picking"/>

View File

@ -95,7 +95,7 @@ class Dialyzer(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
obj.write({"state":"voided"}) obj.write({"state":"voided"})
def confirm(self,ids,context={}): def validate(self,ids,context={}):
id=ids[0] id=ids[0]
obj=self.browse(id) obj=self.browse(id)
patient=obj.patient_id patient=obj.patient_id
@ -211,11 +211,10 @@ class Dialyzer(Model):
'flash': 'Dializer %s is cancelled'%(obj.number), 'flash': 'Dializer %s is cancelled'%(obj.number),
} }
def renew(self,ids,context={}): def to_draft(self,ids,context={}):
obj=self.browse(ids[0]) obj=self.browse(ids[0])
# XXX #if obj.use_time > obj.max_use_time:
if obj.use_time > obj.max_use_time: #raise Exception("Dialyzer %s is expired. (use time > max use time)"%obj.number or '')
raise Exception("Dialyzer %s is expired. (use time > max use time)"%obj.number or '')
obj.cancel() obj.cancel()
obj.write({"state": "new"}) obj.write({"state": "new"})

View File

@ -108,9 +108,10 @@ class ClinicSetting(Model):
if user_id !=1: if user_id !=1:
print("Only admin!!") print("Only admin!!")
return return
for pt in get_model("clinic.patient").search_browse([]): for hdi in get_model("clinic.hd.case.dialyzer").search_browse([]):
pt.write({ dlz=hdi.dialyzer_id
'hn_no': pt.number or "", hdi.write({
'membrane_type': dlz.membrane_type,
}) })
print("Done! ") print("Done! ")