2014-11-01 03:48:22 +00:00
|
|
|
from netforce.model import Model, fields
|
|
|
|
|
2015-01-14 04:31:24 +00:00
|
|
|
class HDCaseStaff(Model):
|
2014-11-25 11:39:53 +00:00
|
|
|
_name="clinic.hd.case.staff"
|
2014-12-04 15:26:20 +00:00
|
|
|
_name_field="staff_id"
|
2015-01-14 05:30:22 +00:00
|
|
|
|
|
|
|
def _get_all(self,ids,context={}):
|
|
|
|
res={}
|
|
|
|
for obj in self.browse(ids):
|
|
|
|
hd_case=obj.hd_case_id
|
|
|
|
patient=hd_case.patient_id
|
|
|
|
res[obj.id]={
|
|
|
|
'sickbed_id': hd_case.sickbed_id.id,
|
|
|
|
'patient_id': patient.id,
|
|
|
|
'patient_type_id': patient.type_id.id,
|
|
|
|
'cycle_id': hd_case.cycle_id.id,
|
|
|
|
'date': hd_case.date,
|
|
|
|
'department_id': hd_case.department_id.id,
|
|
|
|
'state': hd_case.state,
|
|
|
|
}
|
|
|
|
return res
|
|
|
|
|
2014-11-01 03:48:22 +00:00
|
|
|
_fields={
|
2015-01-14 04:31:24 +00:00
|
|
|
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade"),
|
2014-12-20 18:55:26 +00:00
|
|
|
"staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
|
2014-11-25 16:31:29 +00:00
|
|
|
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True),
|
2015-04-29 01:36:05 +00:00
|
|
|
"priop": fields.Selection([("personal","Personal"),('other','Other')],"Priority"),
|
2014-11-01 03:48:22 +00:00
|
|
|
'note': fields.Char("Note"),
|
2015-01-14 05:30:22 +00:00
|
|
|
'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True),
|
2015-03-02 04:03:07 +00:00
|
|
|
'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], function="_get_all",function_multi=True),
|
2015-01-14 05:30:22 +00:00
|
|
|
'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True),
|
|
|
|
'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True),
|
|
|
|
'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True),
|
|
|
|
'date': fields.Date("Date",function="_get_all",function_multi=True),
|
|
|
|
"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",function="_get_all",function_multi=True),
|
2014-11-01 03:48:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
2014-12-20 18:55:26 +00:00
|
|
|
'type': 'doctor',
|
2015-04-29 01:36:05 +00:00
|
|
|
'priop': 'personal',
|
2014-11-01 03:48:22 +00:00
|
|
|
}
|
|
|
|
|
2015-01-14 04:31:24 +00:00
|
|
|
HDCaseStaff.register()
|
2014-11-01 03:48:22 +00:00
|
|
|
|