跳至内容
菜单
此问题已终结

Dear Odoo-users,

Right now we are using a dozen Product Categories within our inventory system. However, the default option that automatically shows first  when creating  a  product is the Product Category with ID #1 (This is visible when exporting these categories) but I would like this to be the category with ID #6.

But I cannot find a way to change this. Not via Studio and not in the XML code via Models or Views.

Could someone help me out please? There must be a simple way to change this.

 

I am using version 13

形象
丢弃

while creating a new product the default product category should be ID#6 that's your requirement right?

编写者

Yes that is my requirement

最佳答案

Hi Marco, 

You can achieve this also by setting defaults.
1. Enable developer mode in settings
2. Start to create a new product and select the category you wish to make as default
3. Click the debug icon (top right side on the menu bar, next to activity and chat icons) and select 'set defaults'
4. On the 'default' dropdown select 'product category'
5. Select the other fields as relevant for  your  case and 'save default'
Hope this helps!
Best


形象
丢弃
编写者

Legend! Works perfectly, need it on more occasions. Thank you!

最佳答案

You can override the method "_get_default_category_id()" from product.template

形象
丢弃
编写者

Could you elaborate further on where to add this line in detail? I suppose under product.template.common.form? And add it within <field name="categ_id" string="Product Category"/>? I don't want to mess things up and try out too much as I might be in the wrong place. I thought it could also be under product.template > Fields > categ_id? Eitherway I could not get it to work properly as I think I might be doing it wrong. As you see not familiar with coding.

编写者 最佳答案

Hi Marcelo, could you elaborate on my comment above? Thank you in-advance!

形象
丢弃
相关帖文 回复 查看 活动
3
7月 24
2696
1
2月 23
1648
3
2月 21
10133
1
8月 18
4481
12
9月 17
8322