clinic/netforce_clinic/models/setting_level.py

23 lines
785 B
Python

from netforce.model import Model, fields, get_model
class SettingLevel(Model):
_name="clinic.setting.level"
_string="Setting Line"
def _get_formular(self,ids,context={}):
res={}
for obj in self.browse(ids):
res[obj.id]=''.join(['%sx'%obj.var_a or '', obj.op or '', obj.var_b or ''])
return res
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting"),
"level_id": fields.Many2One("clinic.personal.level","Level",domain=[['type','=','nurse']]),
'var_a': fields.Char("Ax"),
"op": fields.Selection([["+","+"],["-","-"],["*","*"],["/","/"]],"Operation"),
'var_b': fields.Char("B"),
'formular': fields.Text("Formular",function="_get_formular"),
}
SettingLevel.register()