from netforce.model import Model, fields from netforce.access import get_active_company class LaborCostLine(Model): _name="clinic.labor.cost.line" _string="Labor Cost Line" _name_field="labor_cost_id" _fields={ "labor_cost_id": fields.Many2One("clinic.labor.cost","Cycle Item",required=True), 'staff_id': fields.Many2One("clinic.staff", "Staff"), 'level_id': fields.Many2One("clinic.staff.level", "Level"), 'cycle_id': fields.Many2One("clinic.cycle", "Cycle"), 'qty': fields.Integer("Qty"), 'rate': fields.Float("Rate",scale=2), 'amount': fields.Float("Amount",scale=2), 'date': fields.Date("Date"), "type": fields.Selection([('staff','Staff'),("doctor","Doctor"),('nurse','Nurse')],"Type",required=True), 'company_id': fields.Many2One('company','Company'), } _defaults={ "company_id": lambda *a: get_active_company(), } _order="cycle_id,level_id" LaborCostLine.register()