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

There is product.product and product.template concept in odoo. But in order line, we actually see product.product only which located under Product Variants. But for quite updates, we normally need go to product template to do some stuff. And I see there is no quick button to go to the product template from the variant form. And the messages are totally separated between variant form and template form which cause a lot of inconvenience in practical. Is there anyway to redirect the product variant form directly to the product template or any way to add a related button on the variant form to do that? If there is a module do that, I wish to buy it. Thank you.

形象
丢弃
最佳答案

HI,

You can easily add a field named product_tmpl_id (already exist in product.product model) in the corresponding view. As it is Many2one field, you can click and open the product template easily. Either you can add the field from the UI to the view or from the code.


To add the field to the view from UI, see this: How To Add custom field from UI Without Code

Thanks

形象
丢弃
编写者

Your approach is working on my situation. Thank you very much! You guys Rock!

编写者

Just some further question, is there also product_product_id? Just curious because we can go to the variants pages from product template for multi variant product. But there is no way to reach that for no variant templates. Thank you!

In the product.template model you will have a one2many field name product_variant_ids

最佳答案

On a short form of the product variant (the xml view product.product.view.form.easy) there is sentence "All general settings about this product are managed on the product template". You can click on the part 'product template' to open a related template.

You can add the same link for a rich form:

  1. Turn on the developer mode (settings > activate the developer mode)

  2. Go to a product.product form and in the top right corner click on the 'bug' icon

  3. Choose edit form view

  4. After some field (e.g. after <field name='barcode'/> add <button name="open_product_template" type="object" string="the product template" class="oe_link"/>

  5. Save, refresh a page, and you would have the required button righ on a product variant form


形象
丢弃
编写者

Thank you for you answer. But this method opens a pop up dialog on edit mode which I believe suitable in some certain requirement. But for my situation, Niyas Raphy's answer is more proper. Thank you !

相关帖文 回复 查看 活动
2
8月 23
3028
0
10月 21
1327
1
9月 19
4422
1
2月 25
582
2
1月 24
18144