Community mailing list archives

Re: Fw: Inheriting the selection field "Product Type"('type')

Danimar Ribeiro
- 07/01/2015 09:13:21
Take a look at the following:

Instead you should use the new API and use the selection_add attribute

2015-07-01 10:11 GMT-03:00 Sayali Kothawade <>:
         Thank you very much for your solution.
The solution which you have sent for extending selection field is  for base class,
i.e. under(models.Model).

We are trying to extend that field under  class(osv.osv) .

But When  we tried to add "selection_add" to extend 'type' ("Product Type" ) field by,

class product_template(osv.osv):
    _inherit = 'product.template'
   'type': fields.selection(selection_add=[('raw_material', 'Raw Material')]),

It is showing us  "Internal server error"

Thanks and Regards,
Sayali Kothawade.
Ayanworks Technology Solutions Pvt. Ltd.

From: Martin Trigaux <>
To: Community <>
Sent: Wednesday, 1 July 2015 5:28 PM
Subject: Re: Fw: Inheriting the selection field "Product Type"('type')

On 01/07/15 13:11, Sayali Kothawade wrote:
> 'type': fields.selection([('raw', 'Raw Material'),('product', 'Stockable Product'), ('consu', 'Consumable'), ('service','Service')], 'Product Type', required=True"),

Doing so you are changing the properties of the field, not adding
possibilities in the selection.

Instead you should use the new API (assuming you are developing for
version 8) and use the selection_add attribute.
When redefining a field in the new API, you just need to specify the
attributes that are modified.

Martin Trigaux
Odoo (Formerly OpenERP)
Post to:

Post to:

Danimar Ribeiro