from netforce.model import Model, fields from netforce.access import get_active_company class Branch(Model): _name="clinic.branch" _string="Branch" _key=['name'] _fields={ "name": fields.Char("Name",required=True,search=True), "code": fields.Char("Code",required=True,search=True), "parent_id": fields.Many2One("clinic.branch","Parent"), "company_id": fields.Many2One("company","Company"), 'departments': fields.One2Many("clinic.department","branch_id","Departments"), 'active': fields.Boolean("Active"), } _defaults={ "company_id": lambda *a: get_active_company(), 'active': True, } Branch.register()