2014-10-02 19:12:52 +00:00
|
|
|
from netforce.model import Model, fields
|
|
|
|
|
2014-11-21 17:31:10 +00:00
|
|
|
class HDCaseDialyzerLine(Model):
|
2014-10-02 19:12:52 +00:00
|
|
|
_name="clinic.hd.case.dialyzer"
|
2015-01-29 14:55:05 +00:00
|
|
|
|
|
|
|
def _get_all(self,ids,context={}):
|
|
|
|
res={}
|
|
|
|
for obj in self.browse(ids):
|
2015-08-26 09:13:27 +00:00
|
|
|
hdcase=obj.hd_case_id
|
2015-01-29 14:55:05 +00:00
|
|
|
res[obj.id]={
|
2015-08-26 09:13:27 +00:00
|
|
|
'hdcase_date': hdcase.date,
|
|
|
|
'hdcase_state': hdcase.state,
|
|
|
|
'nurse_id': hdcase.nurse_id.id,
|
2015-01-29 14:55:05 +00:00
|
|
|
}
|
|
|
|
return res
|
|
|
|
|
2015-11-05 04:36:02 +00:00
|
|
|
def _get_dlz_state(self,ids,context={}):
|
|
|
|
res={}
|
|
|
|
for obj in self.browse(ids):
|
|
|
|
dlz=obj.dialyzer_id
|
|
|
|
res[obj.id]=dlz.state
|
|
|
|
return res
|
|
|
|
|
2014-10-02 19:12:52 +00:00
|
|
|
_fields={
|
2015-08-18 11:18:12 +00:00
|
|
|
"hd_case_id": fields.Many2One("clinic.hd.case","HDCase",on_delete="cascade"),
|
2015-01-29 14:55:05 +00:00
|
|
|
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
|
2015-01-23 04:29:50 +00:00
|
|
|
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialyzer",search=True),
|
2014-10-02 19:12:52 +00:00
|
|
|
"description": fields.Char("Description",search=True),
|
|
|
|
"use_time":fields.Integer("Use time"),
|
|
|
|
"max_use_time":fields.Integer("Max use time"),
|
2015-02-10 05:22:04 +00:00
|
|
|
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"),
|
2015-08-18 11:18:12 +00:00
|
|
|
'hdcase_date': fields.Date('Date', function="_get_all",function_multi=True),
|
2015-08-26 09:13:27 +00:00
|
|
|
"hdcase_state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True,function="_get_all",function_multi=True),
|
2015-12-11 04:31:56 +00:00
|
|
|
'nurse_id': fields.Many2One('clinic.staff', 'Use by',function="_get_all",function_multi=True),
|
2015-11-05 04:36:02 +00:00
|
|
|
"state": fields.Selection([("new","New"),("active","Active"),("drop","Drop"),("expire","Expire"),('cancelled','Cancelled')],"Status",function="_get_dlz_state"),
|
2014-10-02 19:12:52 +00:00
|
|
|
}
|
|
|
|
|
2015-08-18 11:18:12 +00:00
|
|
|
_order="hd_case_id.date desc"
|
|
|
|
|
2014-11-21 17:31:10 +00:00
|
|
|
HDCaseDialyzerLine.register()
|
2014-10-02 19:12:52 +00:00
|
|
|
|