Community mailing list archives

Re: ProgrammingError: can't adapt type 'NewId'

Apertoso, Jos De Graeve
- 02/29/2016 02:59:50
Hi Peter,

What happens, is that your onchangeQuantity() method is called with a pseudo recordset.  This means that odoo creates an in-memory representation of your data, without it actually being stored in the database.  This is because onchange can be called for records that the user is inputting in the form, but these are not yet saved.  The user might actually change his mind, and click "discard" instead of saving his data in the database.

With this pseudo recordset, you can modify recordset fields, and the updated fields will be updated in the UI, and will be saved on when the users saves his input. If i recall correctly, the onchange is also triggered on a write() to the model.

You might want to call your bom_Calc() method from the write() method instead of from an onchange method, if this matches your requirements.


Jos De Graeve - Apertoso business ICT

Guido Gezellelaan 16 - B-9800 Deinze - Belgium
Direct: +32 9 381 64 51
General:+32 9 381 64 50
Mobile: +32 475 54 68 80
mail/im/skype: - apertoso

2016-02-29 7:07 GMT+01:00 Peter Mudoko <>:

Guys this errors frustrating me: This is my code:


    _name = ''

    _inherit = ''


    def onchangeQuantity(self):

   for rec in self:




    def bom_Calc(self):

   if isinstance(, models.NewId):"update mrp_bom_line set x_quantityrequired=%s from mrp_bom_line x join mrp_bom s on where" , (2350,

   '''if bom_obj_ids:

for record in bom_obj_ids:

   bom_line = bom_obj.browse(




                       return {'value':vals}'''

I have tried even commented part same error. ANY HELP PLEASE......


Nairobi:gate 256, Nairobi.

P.O.Box - 45855 -00100, Nairobi.

Tel:+254 721449067


Mobile: +254 721449067


Post to: