2014-11-27 03:50:13 +00:00
|
|
|
from netforce.model import Model, fields
|
2015-01-14 07:15:10 +00:00
|
|
|
from netforce.access import get_active_company
|
2014-11-27 03:50:13 +00:00
|
|
|
|
|
|
|
class Branch(Model):
|
|
|
|
_name="clinic.branch"
|
|
|
|
_string="Branch"
|
|
|
|
_key=['name']
|
|
|
|
_fields={
|
|
|
|
"name": fields.Char("Name",required=True,search=True),
|
2015-01-14 13:36:23 +00:00
|
|
|
"code": fields.Char("Code",required=True,search=True),
|
2014-11-27 03:50:13 +00:00
|
|
|
"parent_id": fields.Many2One("clinic.branch","Parent"),
|
2015-01-14 07:15:10 +00:00
|
|
|
"company_id": fields.Many2One("company","Company"),
|
2015-01-15 00:59:27 +00:00
|
|
|
'departments': fields.One2Many("clinic.department","branch_id","Departments"),
|
2015-01-14 07:15:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
|
|
|
"company_id": lambda *a: get_active_company(),
|
2014-11-27 03:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Branch.register()
|