clinic/netforce_clinic/models/schedule_line.py

30 lines
1.1 KiB
Python
Raw Permalink Normal View History

2014-11-14 01:58:12 +00:00
from netforce.model import Model, fields
class ScheduleLine(Model):
_name="clinic.schedule.line"
_string="Schedule Line"
2014-11-21 02:39:26 +00:00
def _get_level(self,ids,context={}):
res={}
for obj in self.browse(ids):
2014-11-27 00:47:38 +00:00
nurse=obj.nurse_id
level=nurse.level_id
level_id=None
if level:
level_id=level.id
res[obj.id]=level_id
2014-11-21 02:39:26 +00:00
return res
2014-11-22 05:44:41 +00:00
2014-11-14 01:58:12 +00:00
_fields={
'schedule_id': fields.Many2One("clinic.schedule","Schedule"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
2014-11-22 05:44:41 +00:00
'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"),
2015-03-16 00:51:28 +00:00
'categ_id': fields.Many2One("clinic.staff.categ","Category"),
2014-11-26 07:35:09 +00:00
'note': fields.Text("Note"),
2015-01-22 10:54:51 +00:00
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
2014-11-14 01:58:12 +00:00
}
ScheduleLine.register()