Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Should I add a new field to product.product or to product.template on odoo 8.0?

By
Stefan Reisich
on 7/17/14, 10:13 AM 3,204 views

In odoo 8.0 product.product and product.template changed.

I want to create a module that adds a new field to the product page.

Should i inherit product.product and add a new field there or is product.template the right place?

 

0

Koffi KPONOUGLO

--Koffi KPONOUGLO--
768
| 5 2 6
Lomé, Togo
--Koffi KPONOUGLO--

Koffi KPONOUGLO

Koffi KPONOUGLO
On 7/17/14, 11:31 AM

Hi Stefan,

See these codes :

class product_template(osv.osv):
    _name = "product.template"
    _inherit = ['mail.thread']
    _description = "Product Template"

class product_product(osv.osv):
    _name = "product.product"
    _description = "Product"
    _inherits = {'product.template': 'product_tmpl_id'}
    _inherit = ['mail.thread']
    _order = 'default_code,name_template'

product.product inherits product.template so you should add you new field in product.product. Your new field will available to both.

 

 

 

1
Walid Baruni
On 7/18/14, 10:20 AM

The main difference between product.product and product.template is when you use product variants.

  • If you add a field to product.template (template), then the field value will be shared to all variants (product.product) of that template.
  • If you add a field to product.product (variant), then the field value will be different in each variant of the same template (product.template)

If you don't use product variants, then I belive its better to add the field to product.product

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/17/14, 10:13 AM
Seen: 3204 times
Last updated: 3/16/15, 8:10 AM