Odoo Help


Update record problem.

Dr Obx
on 4/5/16, 6:54 PM 731 views


I developed a simple module to create relation between ebay listing and product in Odoo. It works perfectly fine but if I want un-bind (remove relation) it won't update record.

# Unbind def


def unbind(self, idlist_id):

context = ''

item_id = self.env['idlist'].search([('name','=',self.name)])

if item_id:

print '== Unbind ID from product ======================================================'

print ' item found'

for item in item_id:

print '== Unbind item_number =========================================================='

print ' ', item.id

print ' ', self.name

print ' ', self.item_number

self.env['product.template'].write({'ebay_item_id': '000000000000', 'assigned': False, 'ebay_listed': False})

#self.env.cr.execute(""" UPDATE product_template SET ebay_item_id = '%s', assigned = '%s', ebay_listed = '%s' WHERE ebay_item_id = '%s' """ %(' ',False,False,self.item_number))

self.env.cr.execute(""" UPDATE idlist SET isused = '%s' WHERE id = '%s' """ %(False,item.id))


print '================================================================================'

raise Warning('Ebay ID successfully UN-BIND`ed')


print '== item not found =============================================================='

I tried direct SQL query and API, none of those method works ;(

WHY ?!?!?!

WHERE is the problem ?!??!

WHAT I'm doing wrong ?!?!?




| 4 4 6
Hyderabad, India

On 4/6/16, 1:17 AM


On which product_template record(object) are u executing below line?

self.env['product.template'].write({'ebay_item_id': '000000000000', 'assigned': False, 'ebay_listed': False})

here you are just taking product_template class but not any object(record) of it....

so, first get the object of product template record and the apply write on it.. like:

<product_template_object>.write({'ebay_item_id': '000000000000', 'assigned': False, 'ebay_listed': False})

Hope it helps!

Don't get it :) However, I tried also direct SQL and it also won't work :( .... don't get it :(

Dr Obx
on 4/6/16, 4:16 PM

Hi Pawan, I think I finally got it :)

Dr Obx
on 4/7/16, 7:58 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/5/16, 6:54 PM
Seen: 731 times
Last updated: 4/6/16, 1:17 AM