clinic/netforce_clinic/models/report_staff.py

54 lines
1.8 KiB
Python
Raw Normal View History

2015-01-30 11:15:13 +00:00
from netforce.model import Model, fields
class ReportStaff(Model):
_name='clinic.report.staff'
_string="Report Staff"
def _get_store(self,ids,context={}):
res={}
for obj in self.browse(ids):
total=len(obj.lines)
res[obj.id]={
'name': total,
}
return res
def _get_all(self,ids,context={}):
res={}
for obj in self.browse(ids):
2015-02-02 10:35:47 +00:00
htotal=len(obj.lines)
ptotal=len(obj.patients)
2015-01-30 11:15:13 +00:00
res[obj.id]={
2015-02-02 10:35:47 +00:00
'hdcase_total': htotal,
'patient_total': ptotal,
2015-01-30 11:15:13 +00:00
}
return res
_fields={
2015-02-02 10:35:47 +00:00
'entry_id': fields.Many2One("clinic.labor.cost.entry",'Labor Cost Entry',search=True),
'staff_id': fields.Many2One("clinic.staff",'Staff',search=True),
"staff_type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type",search=True),
2015-01-30 11:15:13 +00:00
'name': fields.Char("Name", function="_get_store",function_multi=True,store=True),
2015-02-02 10:35:47 +00:00
'date_from': fields.Date("From",search=True),
2015-01-30 11:15:13 +00:00
'date_to': fields.Date("To"),
2015-02-02 10:35:47 +00:00
'hdcase_total': fields.Char("HDCase Total", function="_get_all",function_multi=True),
'patient_total': fields.Char("Patient Total", function="_get_all",function_multi=True),
2015-01-30 11:15:13 +00:00
'lines': fields.One2Many("clinic.report.staff.line","report_staff_id","Lines"),
2015-02-02 10:35:47 +00:00
'patients': fields.One2Many("clinic.report.staff.patient","report_staff_id","Patient Lines"),
2015-01-30 11:15:13 +00:00
}
def create(self,vals,**kw):
id=super().create(vals,**kw)
self.function_store([id])
return id
def write(self,ids,vals,**kw):
super().write(ids,vals,**kw)
self.function_store(ids)
2015-02-02 10:35:47 +00:00
def get_data(self,context={}):
data={}
return data
2015-01-30 11:15:13 +00:00
ReportStaff.register()