I want to create a menu in the sidebar which shows products of a specific category. I was thinking to use a filter for this task, which is set by default.
However, I don't know how to use the value of my configuration inside my XML domain.
Here is how my XML code looks like:
<record id="my_product_search_form_view" model="ir.ui.view">
<field name="name">Products Of My Category Search</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view" />
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<filter string="My Category" name="filter_my_categ" domain="[('categ_id','child_of',my_category)]"/>
</xpath>
</field>
</record>
<record id="my_product_action" model="ir.actions.act_window">
<field name="name">Products Of My Category</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_filter_my_categ":1}</field>
<field name="search_view_id" ref="my_product_search_form_view" />
</record>
<menuitem id="menu_my_products" name="Products Of my Category"
parent="menu_product" action="my_product_action"
/>
I hoped, that when adding 'my_category' to the ir.values table with the model 'product.template' the value will somehow be added to the context - which is not the case & I get an Odoo Client Error NameError: name 'my_category' is not defined
Does anyone know how I can use values of the ir.values table inside my XML view - or at least call a python method inside the context
or domain
tags? Or is there another solution for my task? Thanks for your help!