from netforce.model import Model, fields class ReportStaffLine(Model): _name='clinic.report.staff.line' _string="Report Staff Line" def _get_all(self,ids,context={}): res={} for obj in self.browse(ids): res[obj.id]={ 'date': obj.hd_case_id.date, 'patient_id': obj.hd_case_id.patient_id.id, } return res _fields={ 'report_staff_id': fields.Many2One("clinic.report.staff","Report Staff", required=True, on_delete="cascade"), 'hd_case_id': fields.Many2One("clinic.hd.case","HD Case"), 'date': fields.Date("Date",function="_get_all", function_multi=True), 'patient_id': fields.Many2One("clinic.patient","Patient",function="_get_all",function_multi=True,domain=[['state','=','admit']]), 'amount': fields.Float("Amount"), } ReportStaffLine.register()