# Using pyson\_search\_value on opening a tree/form

**URL:** <https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825>\
**Category:** Developer\
**Created:** [June 4, 2020, 12:26am UTC](https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825 "2020-06-04T00:26:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvong](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/3bc359/32.png) [@rvong](https://discuss.tryton.org/u/rvong)\
**Post date:** [June 4, 2020, 12:26am UTC](https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825/1 "2020-06-04T00:26:54Z")

</div>

Hi,  
I would like to know how do I use the attribute “pyson\_search\_value” that is available on the action object passed in the state action functions on a wizard to filter the records that I want when the tree(list) is displayed. I tried using the similar syntax used for the pyson\_domain, i.e:

action[“pyson\_domain”] = PYSONEncoder().encode([(“party.id”, “=”, party.id), (“template.id”, “=”, product.id)])

But this didn’t work. I scan all the modules and trytond tests files and couldn’t find any examples of how and what is passed to pyson\_search\_value. The reason that I need to use a search instead of domain, is that the domain limits the choices to those used in the expression above when opening the tree that is editable for the user, while a search will not, at least that is my hypothesis.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [June 4, 2020, 9:18am UTC](https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825/2 "2020-06-04T09:18:44Z")

</div>

It works the same way as the `domain` but it must be a domain that can be written in the search bar.  
So using id is not possible, using dot notation is only available on recent version (and limited to 1 level by default).

---

<div class="post-metadata">

**Author:** ![rvong](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/r/3bc359/32.png) [@rvong](https://discuss.tryton.org/u/rvong)\
**Post date:** [June 4, 2020, 2:00pm UTC](https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825/3 "2020-06-04T14:00:26Z")

</div>

Got it working! Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)\
**Post date:** [July 4, 2020, 2:00pm UTC](https://discuss.tryton.org/t/using-pyson-search-value-on-opening-a-tree-form/2825/4 "2020-07-04T14:00:32Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
