import time from netforce.model import Model, fields, get_model class DialyzerDrop(Model): _name="report.dialyzer.drop" _string="Dialyzer [Drop]" _transient=True _fields={ "date": fields.Date("Date"), } _defaults={ 'date': lambda *a: time.strftime("%Y-%m-%d"), } def get_report_data(self,ids,context={}): lines=[] hd_cases=get_model("clinic.dialyzer").search_browse(['state','=','drop']) for dialyzer_ids in hd_cases: lines.append({ 'number' : dialyzer_ids.number, 'usetime': dialyzer_ids.use_time, 'maxuse' : dialyzer_ids.max_use_time, 'createdate' : dialyzer_ids.date, 'expdate' : dialyzer_ids.exp_date, 'patient' : dialyzer_ids.patient_id.name, }) data={ 'lines': lines or "Dialyzer Drop [Empty]", } return data DialyzerDrop.register()