41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
|
from netforce.model import Model, fields, get_model
|
||
|
from netforce.access import get_active_company
|
||
|
|
||
|
class StaffLevel(Model):
|
||
|
_name="clinic.staff.level"
|
||
|
_string="Staff Level"
|
||
|
|
||
|
_fields={
|
||
|
"name": fields.Char("Name",required=True,search=True),
|
||
|
'description': fields.Text("Description", search=True),
|
||
|
'sequence': fields.Integer("Sequence"),
|
||
|
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),("nurse","Nurse")],"Staff Type",required=True, search=True),
|
||
|
}
|
||
|
|
||
|
_defaults={
|
||
|
"company_id": lambda *a: get_active_company(),
|
||
|
'sequence': 0,
|
||
|
'type': 'staff',
|
||
|
}
|
||
|
|
||
|
_order="sequence"
|
||
|
|
||
|
def copy(self,ids,context={}):
|
||
|
obj=self.browse(ids)[0]
|
||
|
vals={
|
||
|
'name': '%s (copy)'%obj.name,
|
||
|
'description': obj.description,
|
||
|
'type': obj.type,
|
||
|
}
|
||
|
new_id=get_model("clinic.staff.level").create(vals)
|
||
|
return {
|
||
|
'next': {
|
||
|
'name': 'clinic_staff_level',
|
||
|
'mode': 'form',
|
||
|
'active_id': new_id,
|
||
|
},
|
||
|
'flash': 'Copy has been succcesfully',
|
||
|
}
|
||
|
|
||
|
StaffLevel.register()
|