30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
from netforce.model import Model, fields
|
|
|
|
class CycleItemLine(Model):
|
|
_name="clinic.cycle.item.line"
|
|
_string="Cycle Item Nurse"
|
|
|
|
def _get_all(self,ids,context={}):
|
|
res={}
|
|
for obj in self.browse(ids):
|
|
citem=obj.cycle_item_id
|
|
pt_total=len([hdcase for hdcase in citem.hd_cases if hdcase.state in ('waiting_payment','paid')])
|
|
res[obj.id]={
|
|
'cstate': citem.state,
|
|
'pt_total': pt_total,
|
|
}
|
|
return res
|
|
|
|
_fields={
|
|
'cycle_item_id': fields.Many2One("clinic.cycle.item", "Cycle Item"),
|
|
'level_id': fields.Many2One("clinic.staff.level", "Level",),
|
|
'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
|
|
'department_id': fields.Many2One("clinic.department","Department"),
|
|
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
|
"cstate": fields.Selection([("draft","Draft"),('pending','Pending'),("validated","Validated")],"Status",function="_get_all",function_multi=True),
|
|
"pt_total": fields.Integer("Patients",function="_get_all",function_multi=True),
|
|
'categ_id': fields.Many2One("clinic.staff.categ",'Category',domain=[['type','=','nurse']]),
|
|
}
|
|
|
|
CycleItemLine.register()
|