db = pooler.get_db(cr.dbname)
local_cr = None
try:
- time.sleep(60) # lame workaround to wait for commit of parent transaction
+ # lame workaround to wait for commit of parent transaction
+ wait_try, wait_max_try = 0, 50
+ while not cr._Cursor__closed and wait_try < wait_max_try:
+ time.sleep(3)
+ wait_try += 1
# grab a fresh browse_record on local cursor
local_cr = db.cursor()
web_root_url = self.pool.get('ir.config_parameter').get_param(local_cr, uid, 'web.base.url')