Inheriting by delegation product template. On a form view, I am placing the field categ_id. This is defaulting to 'All' and I would like it to point to a different category by default. I have tried the following,
<field name="categ_id" domain="[('name', '=', 'Paper')]"/>
which successfully filters the drop down list to just the category I want, but 'All' still shows as default.
Next I tried placing the context in the window action and the field with variations like
context="{'default_categ_id':%(pse.product_category_materials_paper)d}"
context="{'default_categ_id':'Paper'}"
context="{'default_categ_name':'Paper'}"
In the field categ_id definition, default=the _get_default_category_id is the issue from the debugger. It is bypassing the following line,
return self._context.get('categ_id') or self._context.get('default_categ_id')
Book says access to the inherited model are not made available in the new model? So I also tried overriding the function, and it did not work (is this even possible since this is delegation?)
Any pointers would be helpful. Thanks!
Please note that the field categ id has default function running in the base. You can change the
categ_id = fields.Many2one(
'product.category', 'Internal Category',
change_default=True, default=_get_default_category_custom,
required=True, help="Select category for the current product")
Please write the _get_default_category_custom function as you wish. That is to assign category as paper.