43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from netforce.model import Model, fields, get_model
|
|
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"),
|
|
'description': fields.Text("Description", search=True),
|
|
'sequence': fields.Integer("Sequence"),
|
|
"type": fields.Selection([('personal','Personal'),("doctor","Doctor"),("nurse","Nurse")],"Personal Type",required=True, search=True),
|
|
}
|
|
|
|
_defaults={
|
|
"company_id": lambda *a: get_active_company(),
|
|
'sequence': 0,
|
|
'type': 'personal',
|
|
'formular': '',
|
|
}
|
|
|
|
_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.personal.level").create(vals)
|
|
return {
|
|
'next': {
|
|
'name': 'clinic_personal_level',
|
|
'mode': 'form',
|
|
'active_id': new_id,
|
|
},
|
|
'flash': 'Copy has been succcesfully',
|
|
}
|
|
|
|
PersonalLevel.register()
|