from netforce.model import Model, fields class HDCaseDialyzerLine(Model): _name="clinic.hd.case.dialyzer" def _get_all(self,ids,context={}): res={} for obj in self.browse(ids): hdcase_date=obj.hd_case_id.date res[obj.id]={ 'hdcase_date': hdcase_date, } return res _fields={ "hd_case_id": fields.Many2One("clinic.hd.case","HDCase",on_delete="cascade"), "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"), "dialyzer_id": fields.Many2One("clinic.dialyzer","Dialyzer",search=True), "description": fields.Char("Description",search=True), "use_time":fields.Integer("Use time"), "max_use_time":fields.Integer("Max use time"), "membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Membrane Type"), 'hdcase_date': fields.Date('Date', function="_get_all",function_multi=True), } _order="hd_case_id.date desc" HDCaseDialyzerLine.register()