import time from netforce.model import Model, fields from netforce.access import get_active_company class CycleMonthlyLine(Model): _name="clinic.cycle.monthly.line" _string="Cycle Monthly Line" _fields={ "cycle_monthly_id": fields.Many2One("clinic.cycle.monthly","Cycle Monthly"), 'staff_id': fields.Many2One("clinic.staff", "Staff"), 'level_id': fields.Many2One("clinic.staff.level", "Level"), 'date': fields.Date("Date"), 'qty': fields.Integer("Qty"), 'rate': fields.Float("Rate"), 'amount': fields.Float("Amount"), 'company_id': fields.Many2One("company","Company"), "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True), } _defaults={ 'company_id': lambda *a: get_active_company(), 'date': lambda *a: time.strftime("%Y-%m-%d"), } CycleMonthlyLine.register()