Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7355 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 23
8521
0
ก.ย. 20
3670
2
มี.ค. 15
6304
How can i change my odoo domain name ? แก้ไขแล้ว
3
ก.ย. 25
2266
problem backup แก้ไขแล้ว
3
มิ.ย. 24
7017