Merge branch 'production' into fix_acc
commit
61228c3e1c
|
@ -35,7 +35,21 @@
|
||||||
<button string="Drop" type="danger" icon="remove" states="active" method="drop"/>
|
<button string="Drop" type="danger" icon="remove" states="active" method="drop"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
|
<!--<field name="hd_cases" readonly="1"/>-->
|
||||||
|
<field name="hd_cases_dlz" readonly="1">
|
||||||
|
<list>
|
||||||
|
<field name="hdcase_date"/>
|
||||||
|
<field name="use_time"/>
|
||||||
|
</list>
|
||||||
|
<form>
|
||||||
|
<field name="hd_case_id"/>
|
||||||
|
<field name="membrane_type" span="2"/>
|
||||||
|
<field name="dialyzer_type" span="2"/>
|
||||||
|
<field name="use_time"/>
|
||||||
|
<field name="max_use_time"/>
|
||||||
|
<field name="description"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
<field name="pickings" click_action="view_picking"/>
|
<field name="pickings" click_action="view_picking"/>
|
||||||
<field name="hd_cases" readonly="1"/>
|
|
||||||
</related>
|
</related>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Dialyzer(Model):
|
||||||
'ref': fields.Char("Ref."),
|
'ref': fields.Char("Ref."),
|
||||||
"note": fields.Text("Note",search=True),
|
"note": fields.Text("Note",search=True),
|
||||||
"date": fields.DateTime("Create Date",search=True),
|
"date": fields.DateTime("Create Date",search=True),
|
||||||
"use_time": fields.Integer("Use Time"),
|
"use_time": fields.Integer("Last Use Time"),
|
||||||
"max_use_time": fields.Integer("Max Use Time"),
|
"max_use_time": fields.Integer("Max Use Time"),
|
||||||
"exp_date": fields.Date("Expiry Date",search=True),
|
"exp_date": fields.Date("Expiry Date",search=True),
|
||||||
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
|
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
|
||||||
|
@ -29,6 +29,7 @@ class Dialyzer(Model):
|
||||||
"visit_id": fields.Many2One("clinic.visit","Visit",search=True),
|
"visit_id": fields.Many2One("clinic.visit","Visit",search=True),
|
||||||
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True),
|
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",search=True),
|
||||||
"hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case
|
"hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case
|
||||||
|
"hd_cases_dlz": fields.One2Many("clinic.hd.case.dialyzer","dialyzer_id","Dialyzer History"),
|
||||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||||
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -894,14 +894,17 @@ class HDCase(Model):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
is_decrease=context.get('is_decrease')
|
is_decrease=context.get('is_decrease')
|
||||||
for dlz_line in obj.dialyzers:
|
for dlz_line in obj.dialyzers:
|
||||||
|
dlz=dlz_line.dialyzer_id
|
||||||
membrane_type=dlz_line.membrane_type or 'unsub'
|
membrane_type=dlz_line.membrane_type or 'unsub'
|
||||||
dialyzer_type=dlz_line.dialyzer_type or 'low'
|
dialyzer_type=dlz_line.dialyzer_type or 'low'
|
||||||
use_time=dlz_line.use_time or 0
|
use_time=dlz_line.use_time or 0
|
||||||
max_use_time=dlz_line.max_use_time or 0
|
max_use_time=dlz_line.max_use_time or 0
|
||||||
desc=dlz_line.description or ''
|
desc=dlz_line.description or ''
|
||||||
|
#TODO when we to draft after approve hdcase it will update the wrong use time
|
||||||
|
#if use_time > (dlz.use_time or 0):
|
||||||
|
#continue
|
||||||
if is_decrease:
|
if is_decrease:
|
||||||
use_time-=1
|
use_time-=1
|
||||||
print("decrease ok")
|
|
||||||
vals={
|
vals={
|
||||||
'membrane_type': membrane_type,
|
'membrane_type': membrane_type,
|
||||||
'dialyzer_type': dialyzer_type,
|
'dialyzer_type': dialyzer_type,
|
||||||
|
@ -916,9 +919,6 @@ class HDCase(Model):
|
||||||
})
|
})
|
||||||
elif use_time > max_use_time:
|
elif use_time > max_use_time:
|
||||||
raise Exception("Dialyzer is expired!")
|
raise Exception("Dialyzer is expired!")
|
||||||
else:
|
|
||||||
pass
|
|
||||||
dlz=dlz_line.dialyzer_id
|
|
||||||
dlz.write(vals)
|
dlz.write(vals)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -6,21 +6,24 @@ class HDCaseDialyzerLine(Model):
|
||||||
def _get_all(self,ids,context={}):
|
def _get_all(self,ids,context={}):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
dlz=obj.dialyzer_id
|
hdcase_date=obj.hd_case_id.date
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'membrane_type': dlz.membrane_type,
|
'hdcase_date': hdcase_date,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
|
"hd_case_id": fields.Many2One("clinic.hd.case","HDCase",on_delete="cascade"),
|
||||||
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
|
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
|
||||||
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialyzer",search=True),
|
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialyzer",search=True),
|
||||||
"description": fields.Char("Description",search=True),
|
"description": fields.Char("Description",search=True),
|
||||||
"use_time":fields.Integer("Use time"),
|
"use_time":fields.Integer("Use time"),
|
||||||
"max_use_time":fields.Integer("Max use time"),
|
"max_use_time":fields.Integer("Max use time"),
|
||||||
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
||||||
|
'hdcase_date': fields.Date('Date', function="_get_all",function_multi=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_order="hd_case_id.date desc"
|
||||||
|
|
||||||
HDCaseDialyzerLine.register()
|
HDCaseDialyzerLine.register()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue