2014-10-01 08:48:58 +00:00
|
|
|
from netforce.model import Model, fields
|
2014-10-26 04:28:08 +00:00
|
|
|
from netforce.access import get_active_company
|
2014-10-01 08:48:58 +00:00
|
|
|
|
|
|
|
class Department(Model):
|
|
|
|
_name="clinic.department"
|
|
|
|
_string="Department"
|
2014-11-29 14:56:15 +00:00
|
|
|
_key=['code']
|
2014-10-01 08:48:58 +00:00
|
|
|
|
|
|
|
_fields={
|
|
|
|
"name": fields.Char("Name",required=True,search=True),
|
|
|
|
"code": fields.Char("Code",search=True),
|
|
|
|
"parent_id": fields.Many2One("clinic.department", "Parent"),
|
2015-01-11 06:09:40 +00:00
|
|
|
'company_id': fields.Many2One("company","Company"),
|
|
|
|
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
2014-10-01 08:48:58 +00:00
|
|
|
}
|
|
|
|
|
2014-10-26 04:28:08 +00:00
|
|
|
_defaults={
|
|
|
|
'company_id': lambda *a: get_active_company(),
|
|
|
|
}
|
|
|
|
|
2014-10-01 08:48:58 +00:00
|
|
|
Department.register()
|