2014-11-21 02:39:26 +00:00
|
|
|
from netforce.model import Model, fields, get_model
|
2014-11-02 01:26:42 +00:00
|
|
|
from netforce.access import get_active_company
|
|
|
|
|
2014-11-25 11:39:53 +00:00
|
|
|
class StaffLevel(Model):
|
|
|
|
_name="clinic.staff.level"
|
|
|
|
_string="Staff Level"
|
2014-11-02 01:26:42 +00:00
|
|
|
|
|
|
|
_fields={
|
|
|
|
"name": fields.Char("Name",required=True,search=True),
|
2014-11-21 02:39:26 +00:00
|
|
|
'description': fields.Text("Description", search=True),
|
2014-11-02 01:26:42 +00:00
|
|
|
'sequence': fields.Integer("Sequence"),
|
2014-11-25 11:39:53 +00:00
|
|
|
"type": fields.Selection([('staff','Staff'),("doctor","Doctor"),("nurse","Nurse")],"Staff Type",required=True, search=True),
|
2014-11-02 01:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
|
|
|
"company_id": lambda *a: get_active_company(),
|
|
|
|
'sequence': 0,
|
2014-11-25 14:20:30 +00:00
|
|
|
'type': 'nurse',
|
2014-11-02 01:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_order="sequence"
|
|
|
|
|
2014-11-21 02:39:26 +00:00
|
|
|
def copy(self,ids,context={}):
|
|
|
|
obj=self.browse(ids)[0]
|
|
|
|
vals={
|
|
|
|
'name': '%s (copy)'%obj.name,
|
|
|
|
'description': obj.description,
|
|
|
|
'type': obj.type,
|
|
|
|
}
|
2014-11-25 11:39:53 +00:00
|
|
|
new_id=get_model("clinic.staff.level").create(vals)
|
2014-11-21 02:39:26 +00:00
|
|
|
return {
|
|
|
|
'next': {
|
2014-11-25 11:39:53 +00:00
|
|
|
'name': 'clinic_staff_level',
|
2014-11-21 02:39:26 +00:00
|
|
|
'mode': 'form',
|
|
|
|
'active_id': new_id,
|
|
|
|
},
|
|
|
|
'flash': 'Copy has been succcesfully',
|
|
|
|
}
|
|
|
|
|
2014-11-25 11:39:53 +00:00
|
|
|
StaffLevel.register()
|