30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from netforce.model import Model, fields
|
|
|
|
class ScheduleLine(Model):
|
|
_name="clinic.schedule.line"
|
|
_string="Schedule Line"
|
|
|
|
def _get_level(self,ids,context={}):
|
|
res={}
|
|
for obj in self.browse(ids):
|
|
nurse=obj.nurse_id
|
|
level=nurse.level_id
|
|
level_id=None
|
|
if level:
|
|
level_id=level.id
|
|
res[obj.id]=level_id
|
|
return res
|
|
|
|
_fields={
|
|
'schedule_id': fields.Many2One("clinic.schedule","Schedule"),
|
|
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
|
|
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"),
|
|
"nurse_id": fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
|
|
'level_id': fields.Many2One("clinic.staff.level","Level",function="_get_level"),
|
|
'categ_id': fields.Many2One("clinic.staff.categ","Category"),
|
|
'note': fields.Text("Note"),
|
|
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
|
}
|
|
|
|
ScheduleLine.register()
|