import time from netforce.model import Model, fields from netforce.access import get_active_company class StaffCycle(Model): _name="clinic.staff.cycle" _string="Staff Cycle" _fields={ "name": fields.Char("Description",search=True), 'staff_id': fields.Many2One("clinic.staff","Staff",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"), } StaffCycle.register()