Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
11324 Ansichten

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?

 

Avatar
Verwerfen
Beste Antwort

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.

 

 

 

Avatar
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Feb. 25
1445
0
Jan. 25
1211
1
Dez. 24
1590
2
Juni 23
2700
1
Juni 22
5767