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