import time from netforce.model import Model, fields from netforce.access import get_active_company class PersonalCycle(Model): _name="clinic.personal.cycle" _string="Personal Cycle" _fields={ "name": fields.Char("Description",search=True), 'personal_id': fields.Many2One("clinic.personal","Personal",required=True), 'cycle_id': fields.Many2One("clinic.cycle","Cycle",required=True), 'date': fields.DateTime("Date"), 'company_id': fields.Many2One("company","Company"), } _defaults={ "company_id": lambda *a: get_active_company(), 'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"), } PersonalCycle.register()