2015-02-20 01:52:14 +00:00
|
|
|
from netforce.model import Model, fields
|
|
|
|
|
|
|
|
class NameTitle(Model):
|
|
|
|
_name="clinic.name.title"
|
|
|
|
_string="Title"
|
2015-02-24 14:59:49 +00:00
|
|
|
_key=["name"]
|
2015-02-20 01:52:14 +00:00
|
|
|
|
|
|
|
_fields={
|
|
|
|
"name": fields.Char("Name",required=True,search=True),
|
2015-02-24 14:59:49 +00:00
|
|
|
'description': fields.Text("Description"),
|
2015-02-20 01:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_order="name"
|
|
|
|
|
2015-02-24 14:59:49 +00:00
|
|
|
def name_search(self,name,domain=None,condition=[],context={},**kw):
|
|
|
|
dom=[["name","ilike","%"+name+"%"]]
|
|
|
|
if domain:
|
|
|
|
dom=[dom,domain]
|
|
|
|
ids1=self.search(dom)
|
|
|
|
dom=[["description","ilike","%"+name+"%"]]
|
|
|
|
if domain:
|
|
|
|
dom=[dom,domain]
|
|
|
|
ids2=self.search(dom)
|
|
|
|
ids=list(set(ids1+ids2))
|
|
|
|
return self.name_get(ids,context=context)
|
|
|
|
|
2015-02-20 01:52:14 +00:00
|
|
|
NameTitle.register()
|