Odoo Help

Welcome!

This community 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.

0

Odoo Rollback error (mass editing)

By
harsh jain
on 6/10/16, 11:00 PM 413 views

Hi,

I am trying to do mass editing of products (by matching image file names with internal refernce and writing to the image field in products). Since writing values will keep building up cache , i am trying to commit after each write and invalidating cache. But when a error occurs after commit , the rollback operation is not working . Can anyone help me with this ?


import pdb

try:

rec=self.env['product.template'].search([('id','in',self._context.get('active_ids',False))])

pdb.set_trace()

rec.image=_get_base64_image(file_path)

print "9=========",self.env.cache

self.env.cr.commit()

rec.invalidate_cache(None,[rec.id])

except:

self.env.cr.rollback()

raise

0
harsh jain
On 6/11/16, 5:04 AM

sorry for the incorrect question.....can't rollback after committing

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 6/10/16, 11:00 PM
Seen: 413 times
Last updated: 6/11/16, 5:04 AM