Community mailing list archives

community@mail.odoo.com

ProgrammingError: can't adapt type 'NewId'

by
mudoko
- 02/29/2016 01:01:02

Guys this errors frustrating me: This is my code:


Bom_Extend(models.Model):

    _name = 'mrp.bom'

    _inherit = 'mrp.bom'

    @api.onchange('quantity','x_batch')

    def onchangeQuantity(self):

   for rec in self:

       rec.x_batch=rec.quantity/rec.product_qty

self.bom_Calc()

    @api.multi

    def bom_Calc(self):

   if isinstance(self.id, models.NewId):

   self.env.cr.execute("update mrp_bom_line set x_quantityrequired=%s from mrp_bom_line x join mrp_bom s on x.bom_id=s.id where s.id=%s" , (2350,self.id))

   '''if bom_obj_ids:

for record in bom_obj_ids:

   bom_line = bom_obj.browse(record.id)

               bom_line.x_quantityrequired=bom_line.product_qty

               bom_line.x_shortage=bom_line.x_quantityrequired-bom_line.x_qoh

                       vals={'x_testing':self.id}

                       return {'value':vals}'''

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

Laballieds,

Nairobi:gate 256, Nairobi.

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

Tel:+254 721449067

Email petypi@gmail.com

Mobile: +254 721449067

Website www.softlinkoptions.com