Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6997 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 23
8097
0
thg 9 20
3328
2
thg 3 15
5886
3
thg 6 24
1804
problem backup Đã xử lý
3
thg 6 24
6575