clinic/netforce_clinic/models/partner.py

34 lines
946 B
Python
Raw Normal View History

2014-12-16 09:53:36 +00:00
from netforce.model import Model, fields
class Partner(Model):
_inherit="partner"
_fields={
2015-02-13 07:46:39 +00:00
'walkin_cust': fields.Boolean("Walkin Customer"),
'is_patient': fields.Boolean("Is Patient"),
2015-02-18 16:53:29 +00:00
'is_staff': fields.Boolean("Is Staff"),
2014-12-16 09:53:36 +00:00
}
2015-07-22 01:30:15 +00:00
def name_get(self,ids,context={}):
vals=[]
for obj in self.browse(ids):
name=obj.name or ""
if obj.code:
name=" %s (%s)"%(name,obj.code)
vals.append((obj.id,name))
return vals
def name_search(self,name,domain=None,condition=[],context={},**kw):
dom=[["name","ilike","%"+name+"%"]]
if domain:
dom=[dom,domain]
ids1=self.search(dom)
dom=[["code","ilike","%"+name+"%"]]
if domain:
dom=[dom,domain]
ids2=self.search(dom)
ids=list(set(ids1+ids2))
return self.name_get(ids,context=context)
2014-12-16 09:53:36 +00:00
Partner.register()