Am Mittwoch, 12. Oktober 2016 11:09:40 UTC+2 schrieb Simon Klemenc:
> Hi,
> 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 =[("zip", "=", clause[2]), ("active", "=", 
> True)])
>     parties = [ 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 
class Party:

    def search(cls, domain, offset=0, limit=None, order=None, count=False, 
        newdom = []
        for item in domain:
            if item[0]=="address":
                newdom.append([u""], item[1], item[2])
        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 
> for...
> best regards,
> simon

Hope this helps,

Kind regards,

You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit

Reply via email to