# Filter Attribute Not allowing to fill Many2One field

**URL:** https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007
**Category:** Developer
**Created:** [March 9, 2023, 9:33am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007 "2023-03-09T09:33:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![shervas](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@shervas](https://discuss.tryton.org/u/shervas)
#### Post date: [March 9, 2023, 9:33am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/1 "2023-03-09T09:33:16Z")

</div>

Hi,  
I have a One2Many that are attachments of files and directories and If an attachment have parent shoudn’t display on top level, you should have to open the parent to see it.  
I have the o2m field with the attribute filter=[‘parent’, ‘=’, None]. And a Many2One with the name of the parent that is the one I use in the filter. The problem that I’m getting is that the filter is doing good, but when I click on a record of the o2m and try to fill the parent field, no options are displayed.

---

<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: [March 9, 2023, 9:39am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/2 "2023-03-09T09:39:10Z")

</div>

> [@shervas](#):
>
> I click on a record of the o2m and try to fill the parent field, no options are displayed.

It is normal as the filter constraint the `parent` to be `None`.

---

<div class="post-metadata">

### Author: ![shervas](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@shervas](https://discuss.tryton.org/u/shervas)
#### Post date: [March 9, 2023, 9:41am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/3 "2023-03-09T09:41:52Z")

</div>

And if I want to be able to fill the m2o and filtering the o2m view how can I do it?. Also both fields are pointing to the same model.

---

<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: [March 9, 2023, 9:46am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/4 "2023-03-09T09:46:53Z")

</div>

> [@shervas](#):
>
> if I want to be able to fill the m2o and filtering the o2m

You can not because it is illogical.

---

<div class="post-metadata">

### Author: ![shervas](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@shervas](https://discuss.tryton.org/u/shervas)
#### Post date: [March 9, 2023, 10:19am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/5 "2023-03-09T10:19:33Z")

</div>

So which is the way to have a o2m tree view with different levels?

---

<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: [March 9, 2023, 10:53am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/6 "2023-03-09T10:53:41Z")

</div>

You can use `filter` but the tree structure has to be created from `One2Many` on the nodes.  
Like it is done for packages on shipment see [Use filter instead of Function field for root packages (!353) · Merge requests · Tryton / Tryton · GitLab](https://foss.heptapod.net/tryton/tryton/-/merge_requests/353)

---

<div class="post-metadata">

### Author: ![shervas](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/s/a3d4f5/32.png) [@shervas](https://discuss.tryton.org/u/shervas)
#### Post date: [March 9, 2023, 11:03am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/7 "2023-03-09T11:03:26Z")

</div>

Yess, thanks a lot for the help!

---

<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: [April 8, 2023, 11:03am UTC](https://discuss.tryton.org/t/filter-attribute-not-allowing-to-fill-many2one-field/6007/8 "2023-04-08T11:03:53Z")

</div>

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