Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
7045 Visninger

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

Avatar
Kassér
Forfatter Bedste svar

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

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
2
feb. 23
8169
0
sep. 20
3361
2
mar. 15
5936
3
jun. 24
1858
3
jun. 24
6625