This question has been flagged
4 Replies
20555 Views

Haven't found any conclusive information on this yet. Let's say I want to have a text field for the color of my product. Can anyone explain in a clear way, step by step, how to  do this? 

Avatar
Discard
Best Answer

This piece of documentation will help out any developer:

https://doc.odoo.com/trunk/server/03_module_dev/

Especially the subject of object inheritance. 

In simple steps:

  • Create a module
  • Create a file for overriding product.product (since you want to add a field).
  • Add the field in code
  • Install module
  • Presto!
Avatar
Discard
Author Best Answer

Ok, thanks.  That's is how to do it programatically, which we might want to do in the future, but what are te steps to follow using the Odoo web interface?

 

Avatar
Discard

Good question. I have never done it that way because of the risk of losing all adjustments after updating, so I guess another help-person should handle this question.

If you add a new custom field using the x_... naming convention we are told that this will survive updates. You should not have to be a programmer and to have to create a module to simply add an additional field to one of the models. You aren't even allowed to add your own modules if you are running on the Odoo hosted saas system - this is how customisation is achieved there - see here:- http://www.slideshare.net/openobject/how-to-customize-views-menues-of-open-erp-online-in-a-sustainable-way-frederic-gilson

Interesting post kurt. I did not know that. I thought it was just a convention, but did not realise that it is an actual rule.

Best Answer

The steps to add custom attributes to product is : 

  1. Activation of developer mode
  2. Go to product form : Sale-> Products -> Products -> Form view -> In the field "Debug view"  select "manage views"->  Edit -> (Select the place wher you want to put you custom field) -> Enherited view 
  3. Enherit the view : clic on Enherited view (when you clic on this bouton you will get another new node.)
  4. Adding your custom attribute : Go inside the new node created. clic on the icon "plus" at right -> New field -> Field name -> Field label -> Field type -> Save -> Update -> String(lLabel of field) -> Update -> Close -> Close

It is finished.

Avatar
Discard
Best Answer

Odoo version 8 support natively attributes; any kind of attributes directly on the product form. In version 7 there is a basic module that add attributes on products: (don't remember the name but it's something like product_mrp_attribute)

Avatar
Discard
Author

Fabien, could you elaborate a bit more on this? Or point me to the corresponding docs?

Hello Fabian, Odoo V8 is natively supports attributes but those are not as per general requirement. Odoo provided attribute feature for to connect product template and Product object. The actual usage is if in product.product object ( not product template ) if anyone want to add new attribute of product then ? what they do ? If they add attribute and value in template then with cross join odoo will create new products. But that we are not looking for. If you aware with Magento system, we can add new attribute and set value. In kind of ecommerce system, different product have different attributes. So to deal with that we can't go for to create new column everytime but there should be something like attributes with one2many relation with product.product ( Not with template ) so that we can select attribute and give value. I hope you get me what i trying to say.

Where can we add those attributes in the UI? I have v8 before me and I don't see any menu item where you can add them, and I have enabled "Support custom product attributes". Or do you mean extending product attributes by writing a custom module?