import time from netforce.model import Model, fields class PatientCause(Model): _name="clinic.patient.cause" _string="Patient Cause" _fields={ "patient_id": fields.Many2One("clinic.patient","Patient",required=True,on_delete="cascade"), "cause_id": fields.Many2One("clinic.cause.chronic","Cause"), "date_cause": fields.Date("Date Cause"), } _defaults={ 'date_cause': lambda *a: time.strftime("%Y-%m-%d"), } PatientCause.register()