Am Mittwoch, 12. Oktober 2016 11:09:40 UTC+2 schrieb Simon Klemenc:
> I found a very old thread on this, but it seems all the docs covering this
> have disappeared.
> So, in order to search parties by zip code, i need to make a function
> field for the party and a function field searcher function?
> Is there an example i can have a look?
> The other idea would be to do something like this:
> def search_rec_name(cls, name, clause):
> domain = super(Party, cls).search_rec_name(name, clause)
> Address = Pool().get("party.address")
> addresses = Address.search([("zip", "=", clause), ("active", "=",
> parties = [address.party.id for address in addresses]
> domain.append(("id", "in" parties))
> Anyone has the same implemented?
I have tried it once but finally did not use it.
If i remember well, it worked this way (but i haven't tested it again) in
def search(cls, domain, offset=0, limit=None, order=None, count=False,
newdom = 
for item in domain:
newdom.append([u"address.zip"], item, item)
return super(Party, cls).search(newdom, offset=offset, limit=limit,
order=order, count=count, query=query)
In this case if you enter "address: put-zip-code-here" it should give you
all parties with this zip code...
Party lookup by zip code is a very important demand at the company i work
> best regards,
Hope this helps,
You received this message because you are subscribed to the Google Groups
To view this discussion on the web visit