Skip to Content
Menu
This question has been flagged

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.

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Author

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

Best Answer

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


Avatar
Discard
Author

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 !

Related Posts Replies Views Activity
2
Aug 23
2892
0
Oct 21
1286
1
Sep 19
4374
1
Feb 25
497
2
Jan 24
17939