[FIX] google_calendar: write info on current user with superuser_id
If the user is not admin, it will synchronize always from start, because last_synchro_date cannot be write on res_users
This commit is contained in:
parent
d00d90a95e
commit
e4030e2016
|
@ -296,7 +296,7 @@ class google_calendar(osv.AbstractModel):
|
||||||
|
|
||||||
registry = openerp.modules.registry.RegistryManager.get(request.session.db)
|
registry = openerp.modules.registry.RegistryManager.get(request.session.db)
|
||||||
with registry.cursor() as cur:
|
with registry.cursor() as cur:
|
||||||
self.pool['res.users'].write(cur, uid, [uid], {'google_calendar_token': False, 'google_calendar_token_validity': False}, context=context)
|
self.pool['res.users'].write(cur, SUPERUSER_ID, [uid], {'google_calendar_token': False, 'google_calendar_token_validity': False}, context=context)
|
||||||
|
|
||||||
raise self.pool.get('res.config.settings').get_config_warning(cr, _(error_msg), context=context)
|
raise self.pool.get('res.config.settings').get_config_warning(cr, _(error_msg), context=context)
|
||||||
raise
|
raise
|
||||||
|
@ -698,7 +698,7 @@ class google_calendar(osv.AbstractModel):
|
||||||
cr.rollback()
|
cr.rollback()
|
||||||
registry = openerp.modules.registry.RegistryManager.get(request.session.db)
|
registry = openerp.modules.registry.RegistryManager.get(request.session.db)
|
||||||
with registry.cursor() as cur:
|
with registry.cursor() as cur:
|
||||||
self.pool['res.users'].write(cur, uid, [uid], {'google_calendar_last_sync_date': False}, context=context)
|
self.pool['res.users'].write(cur, SUPERUSER_ID, [uid], {'google_calendar_last_sync_date': False}, context=context)
|
||||||
error_key = simplejson.loads(str(e))
|
error_key = simplejson.loads(str(e))
|
||||||
error_key = error_key.get('error', {}).get('message', 'nc')
|
error_key = error_key.get('error', {}).get('message', 'nc')
|
||||||
error_msg = "Google is lost... the next synchro will be a full synchro. \n\n %s" % error_key
|
error_msg = "Google is lost... the next synchro will be a full synchro. \n\n %s" % error_key
|
||||||
|
|
Loading…
Reference in New Issue