[FIX] calendar: synchro - use current user to synchronize as uid
Else, function like get_primary_calendar return values from administrator and not the user to synchronize
This commit is contained in:
parent
e3ba594789
commit
2c09ba980d
|
@ -536,7 +536,7 @@ class google_calendar(osv.AbstractModel):
|
||||||
for user_to_sync in ids:
|
for user_to_sync in ids:
|
||||||
_logger.info("Calendar Synchro - Starting synchronization for a new user [%s] " % user_to_sync)
|
_logger.info("Calendar Synchro - Starting synchronization for a new user [%s] " % user_to_sync)
|
||||||
try:
|
try:
|
||||||
resp = self.synchronize_events(cr, uid, [user_to_sync], lastSync=True, context=None)
|
resp = self.synchronize_events(cr, user_to_sync, False, lastSync=True, context=None)
|
||||||
if resp.get("status") == "need_reset":
|
if resp.get("status") == "need_reset":
|
||||||
_logger.info("[%s] Calendar Synchro - Failed - NEED RESET !" % user_to_sync)
|
_logger.info("[%s] Calendar Synchro - Failed - NEED RESET !" % user_to_sync)
|
||||||
else:
|
else:
|
||||||
|
@ -564,7 +564,7 @@ class google_calendar(osv.AbstractModel):
|
||||||
user_to_sync = ids and ids[0] or uid
|
user_to_sync = ids and ids[0] or uid
|
||||||
current_user = self.pool['res.users'].browse(cr, SUPERUSER_ID, user_to_sync, context=context)
|
current_user = self.pool['res.users'].browse(cr, SUPERUSER_ID, user_to_sync, context=context)
|
||||||
|
|
||||||
st, current_google, ask_time = self.get_calendar_primary_id(cr, uid, context=context)
|
st, current_google, ask_time = self.get_calendar_primary_id(cr, user_to_sync, context=context)
|
||||||
|
|
||||||
if current_user.google_calendar_cal_id:
|
if current_user.google_calendar_cal_id:
|
||||||
if current_google != current_user.google_calendar_cal_id:
|
if current_google != current_user.google_calendar_cal_id:
|
||||||
|
@ -577,8 +577,8 @@ class google_calendar(osv.AbstractModel):
|
||||||
"url": ''
|
"url": ''
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastSync and self.get_last_sync_date(cr, uid, context=context) and not self.get_disable_since_synchro(cr, uid, context=context):
|
if lastSync and self.get_last_sync_date(cr, user_to_sync, context=context) and not self.get_disable_since_synchro(cr, user_to_sync, context=context):
|
||||||
lastSync = self.get_last_sync_date(cr, uid, context)
|
lastSync = self.get_last_sync_date(cr, user_to_sync, context)
|
||||||
_logger.info("[%s] Calendar Synchro - MODE SINCE_MODIFIED : %s !" % (user_to_sync, lastSync.strftime(DEFAULT_SERVER_DATETIME_FORMAT)))
|
_logger.info("[%s] Calendar Synchro - MODE SINCE_MODIFIED : %s !" % (user_to_sync, lastSync.strftime(DEFAULT_SERVER_DATETIME_FORMAT)))
|
||||||
else:
|
else:
|
||||||
lastSync = False
|
lastSync = False
|
||||||
|
@ -589,14 +589,14 @@ class google_calendar(osv.AbstractModel):
|
||||||
_logger.info("[%s] Calendar Synchro - MODE FULL SYNCHRO - NEW CAL ID" % user_to_sync)
|
_logger.info("[%s] Calendar Synchro - MODE FULL SYNCHRO - NEW CAL ID" % user_to_sync)
|
||||||
|
|
||||||
new_ids = []
|
new_ids = []
|
||||||
new_ids += self.create_new_events(cr, uid, context=context)
|
new_ids += self.create_new_events(cr, user_to_sync, context=context)
|
||||||
new_ids += self.bind_recurring_events_to_google(cr, uid, context)
|
new_ids += self.bind_recurring_events_to_google(cr, user_to_sync, context)
|
||||||
|
|
||||||
res = self.update_events(cr, uid, lastSync, context)
|
res = self.update_events(cr, user_to_sync, lastSync, context)
|
||||||
|
|
||||||
current_user.write({'google_calendar_last_sync_date': ask_time})
|
current_user.write({'google_calendar_last_sync_date': ask_time})
|
||||||
return {
|
return {
|
||||||
"status": res and "need_refresh" or "no_new_event_form_google",
|
"status": res and "need_refresh" or "no_new_event_from_google",
|
||||||
"url": ''
|
"url": ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<openerp>
|
<openerp>
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<!-- Scheduler for Lead Scoring and Assignation -->
|
|
||||||
<record forcecreate="True" id="ir_cron_sync_all_cals" model="ir.cron">
|
<record forcecreate="True" id="ir_cron_sync_all_cals" model="ir.cron">
|
||||||
<field name="name">Calendar synchronization</field>
|
<field name="name">Calendar synchronization</field>
|
||||||
<field eval="True" name="active" />
|
<field eval="True" name="active" />
|
||||||
|
|
Loading…
Reference in New Issue