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
|
|
|
|
|
|
|
|
class PersonalLevel(Model):
|
|
|
|
_name="clinic.personal.level"
|
|
|
|
_string="Personal Level"
|
|
|
|
|
|
|
|
_fields={
|
|
|
|
"name": fields.Char("Name",required=True,search=True),
|
|
|
|
'formular': fields.Text("Formular"),
|
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-21 02:39:26 +00:00
|
|
|
"type": fields.Selection([('personal','Personal'),("doctor","Doctor"),("nurse","Nurse")],"Personal 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-05 05:06:43 +00:00
|
|
|
'type': 'personal',
|
2014-11-02 01:26:42 +00:00
|
|
|
'formular': '',
|
|
|
|
}
|
|
|
|
|
|
|
|
_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,
|
|
|
|
}
|
|
|
|
new_id=get_model("clinic.personal.level").create(vals)
|
|
|
|
return {
|
|
|
|
'next': {
|
|
|
|
'name': 'clinic_personal_level',
|
|
|
|
'mode': 'form',
|
|
|
|
'active_id': new_id,
|
|
|
|
},
|
|
|
|
'flash': 'Copy has been succcesfully',
|
|
|
|
}
|
|
|
|
|
2014-11-02 01:26:42 +00:00
|
|
|
PersonalLevel.register()
|