Help

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

How to extend a XML search filter view and add an additional filter ?

2 Comments
Avatar
Discard
Avatar
odoo
-

You can modify/extend the Parent View with mode=primary. This creates a brand new View. In order to use this View you need to reference it somewhere in Odoo. Without referencing it, it will never be used.

Avatar
odoo
-

(edited comment)
Thanks Ray for your 2 amazing clarifications

Two way to fix the issue:

1. (recommended) Completely remove the 'mode' field, as it is not needed in our context.
2. Change the value of the 'mode' field from 'primary' to 'extension'

The documentation on the mode field is available here https://www.odoo.com/documentation/18.0/developer/reference/user_interface/view_records.html

Care should be taken when we copy an example from outside. Before reusing it, we should carefully understand the meaning of each field.

So we would use 'primary' mode for a new view that would however be based on another view. In this case, reference of the new view should be used to render the new content. That was not the case here, this is why the 'additional_filter' was not rendered in the parent view.

1 Answer
0
Avatar
odoo
Best Answer

MODE. 

PRIMARY means you are making a NEW View and need to define where this new View is used or it will never be used. 

It should be INHERIT if you want your change to be applied to an EXISTING View. 

Avatar
Discard