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"), } _defaults={ "company_id": lambda *a: get_active_company(), } Branch.register()