Community mailing list archives
Re: Fw: Inheriting the selection field "Product Type"('type')by
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 <firstname.lastname@example.org>:
Hello,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 <email@example.com>
To: Community <firstname.lastname@example.org>
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. https://www.odoo.com/documentation/8.0/reference/orm.html#openerp.fields.Selection https://github.com/odoo/odoo/blob/f59f9e7/addons/account/models/account_payment.py#L185 -- Martin Trigaux Odoo (Formerly OpenERP) https://odoo.com https://github.com/mart-e