Community mailing list archives

community@mail.odoo.com

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

by
OpenERP Master
- 07/01/2015 15:56:33
I would concur with Ana, You should not alter this fields selection. There are many parts of the system that depend on that field containing specific values. If you fix your issue here, you would introduce many other issues elsewhere, unless you know what your doing of course.

On Wed, Jul 1, 2015 at 8:24 AM, Ana Juaristi <ajuaristio@gmail.com> wrote:
i would not do that.
The field you are trying to modify is not only informative but operative. It's probable you are breaking something unexpected.
Just create another field and make you need there

2015-07-01 15:11 GMT+02:00 Sayali Kothawade <sayali.kothawade@ayanworks.com>:
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 <mat@odoo.com>
To: Community <community@mail.odoo.com>
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
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
CEO Avanzosc, S.L : Office phone / Tfono oficina: (+34) 943 02 69 02
Ana Juaristi Olalde : Personal phone: 677 93 42 59. User/usuario skype: Avanzosc
www.openerpsite.com


El contenido de esta comunicación y de toda su documentación anexa es confidencial y se dirige exclusivamente a su destinatario. El uso no autorizado de esta información está prohibido por la legislación vigente. Si usted no es el destinatario le rogamos nos lo indique, no comunique su contenido a terceros y proceda a su destrucción. Disculpe las molestias que le haya ocasionado la recepción indebida de este e-mail. Sus datos figuran en un fichero cuyo titular es Avanzosc, S.L., a quien usted puede dirigirse para ejercer sus derechos de acceso, rectificación, cancelación y oposición en Klara Donea 13, 20720, Azkoitia (Gipuzkoa), Tef. 943 02 69 02 - administracion@avanzosc.es

Komunikazio honen edukia eta dokumentazio erantsia konfidentziala da eta hartzaileak bakarrik jaso beharko luke. Indarrean dagoen legeriak debekatu egiten du bertan eskainitako informazioa baimenik gabe erabiltzea. Komunikazioa zuri iritsi bazaizu, baina zu ez bazara hartzailea, mesedez, guri jakinarazi, eta jasotako informazioa ez inori jakinarazi eta suntsitu. Barkatu okerreko email hau jasotzeak eragindako eragozpenak. Zure datuak Avanzosc, S.L. enpresaren fitxategietan sartuta daude. Zure datuak atzitzea eska dezakezu, bai eta, datuak zuzentzea, ezereztea eta tratamenduari aurka egitea ere. Horretarako, enpresara jo dezakezu, helbide honetan: Klara Donea 13 20720, Azkoitia (Gipuzkoa), telefonoa: 943 02 69 02 - administracion@avanzosc.es
This message and all documents attached to it are confidential and intended only for the person or entity to which it is addressed. Any use of this information by unauthorised persons is prohibited under current legislation. If you received this message by error, please advise us, destroy it and refrain from communicating its contents to third parties. We apologise for any inconvenience receiving this email improperly may cause to you. Your personal data are included in a file owned by Avanzosc, S.L. If you want to exercise your rights of access, correction, erasure and objection you can contact the Controller at Klara Donea 13 20720, Azkoitia (Gipuzkoa), T: 943 02 69 02 – administracion@avanzosc.es

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe