conv_bal
watcha.h 2015-03-17 11:35:48 +07:00
parent 7cb1e14c09
commit 251ca4a592
3 changed files with 21 additions and 6 deletions

View File

@ -36,14 +36,13 @@
<field name="hd_acc" span="2"/> <field name="hd_acc" span="2"/>
<field name="date" invisible="1" span="2"/> <field name="date" invisible="1" span="2"/>
<newline/> <newline/>
<field name="wt_start" span="2" attrs='{"required":[["state","=","waiting_treatment"]]}'/> <field name="wt_start" onchange="onchange_weight" attrs='{"required":[["state","=","waiting_treatment"]]}' span="2"/>
<field name="wt_stop" span="2"/> <field name="wt_stop" onchange="onchange_weight" span="2"/>
<field name="hct" span="2" onchange="onchange_hct" attrs='{"invisible":[["hct_include","=",false]],"required": [["hct_include","=", true]]}'/> <field name="hct" span="2" onchange="onchange_hct" attrs='{"invisible":[["hct_include","=",false]],"required": [["hct_include","=", true]]}'/>
<field name="hct_msg" span="4" readonly="1" attrs='{"invisible":[["hct_include","=",false]]}'/> <field name="hct_msg" span="4" readonly="1" attrs='{"invisible":[["hct_include","=",false]]}'/>
<newline/> <newline/>
<field name="bp_start" span="2"/> <field name="bp_start" span="2"/>
<field name="bp_stop" span="2"/> <field name="bp_stop" span="2"/>
<!--<field name="membrane_type" span="2" />-->
<field name="bid_flow_rate" span="2"/> <field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/> <field name="ultrafittration" span="2"/>
<field name="dialyzers" nolabel="1" attrs='{"readonly":[["state","=","completed"]]}'> <field name="dialyzers" nolabel="1" attrs='{"readonly":[["state","=","completed"]]}'>

View File

@ -460,6 +460,9 @@ class HDCase(Model):
def cancelled(self,ids,context={}): def cancelled(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
obj.sickbed_id.write({
'available': True,
})
obj.write({"state":"cancelled"}) obj.write({"state":"cancelled"})
def make_invoices(self,ids,context={}): def make_invoices(self,ids,context={}):
@ -912,6 +915,10 @@ class HDCase(Model):
obj.write({ obj.write({
'state': state, 'state': state,
}) })
# update sickbed
obj.sickbed_id.write({
'available': False,
})
return { return {
'next': { 'next': {
@ -967,7 +974,7 @@ class HDCase(Model):
'nurse_id': nurse_id, 'nurse_id': nurse_id,
}) })
obj.sickbed_id.write({ obj.sickbed_id.write({
'state': 'available', 'available': True,
}) })
set_active_user(user_id) set_active_user(user_id)
return { return {
@ -1383,7 +1390,7 @@ class HDCase(Model):
if vals['sickbed_id']!=obj.sickbed_id.id and obj.state!='draft': if vals['sickbed_id']!=obj.sickbed_id.id and obj.state!='draft':
if obj.sickbed_id: if obj.sickbed_id:
obj.sickbed_id.write({ obj.sickbed_id.write({
'state': 'available', 'available': True,
}) })
sb=get_model("clinic.sickbed").browse(vals['sickbed_id']) sb=get_model("clinic.sickbed").browse(vals['sickbed_id'])
sb.write({ sb.write({
@ -1429,6 +1436,13 @@ class HDCase(Model):
data['duration']=cycle.duration data['duration']=cycle.duration
return data return data
def onchange_weight(self,context={}):
data=context['data']
wt_stop=data['wt_stop'] or 0
wt_start=data['wt_start'] or 0
data['ultrafittration']=wt_stop-wt_start
return data
def new_shop(self,ids,context={}): def new_shop(self,ids,context={}):
return { return {
'next': { 'next': {

View File

@ -53,7 +53,9 @@ class HDCasePopupDiscontinue(Model):
'note': obj.note, 'note': obj.note,
'state': 'cancelled', 'state': 'cancelled',
}) })
hd_case.sickbed_id.write({
'available': True,
})
prod_ids=[] prod_ids=[]
for line in obj.lines: for line in obj.lines:
prod=line.product_id prod=line.product_id