[FIX] google_calendar: remove event in google while being only attendee

If User A created an event In Odoo, inviting User B,
Then, if User A sync his calendar with Google,
user B have an invitation to this event in Google,
if user B refuses the event AND remove it from his Google calendar
and then syncs his calendar to Odoo,
the event was removed from the Odoo calendar, of all attendees.

opw-641356
This commit is contained in:
Denis Ledoux 2015-06-02 15:04:00 +02:00
parent 37f3d08c18
commit 815f91b951
1 changed files with 3 additions and 2 deletions

View File

@ -84,13 +84,14 @@ class SyncEvent(object):
def compute_OP(self, modeFull=True): def compute_OP(self, modeFull=True):
#If event are already in Gmail and in OpenERP #If event are already in Gmail and in OpenERP
is_owner = self.OE.event.env.user.id == self.OE.event.user_id.id
if self.OE.found and self.GG.found: if self.OE.found and self.GG.found:
#If the event has been deleted from one side, we delete on other side ! #If the event has been deleted from one side, we delete on other side !
if self.OE.status != self.GG.status: if self.OE.status != self.GG.status and is_owner:
self.OP = Delete((self.OE.status and "OE") or (self.GG.status and "GG"), self.OP = Delete((self.OE.status and "OE") or (self.GG.status and "GG"),
'The event has been deleted from one side, we delete on other side !') 'The event has been deleted from one side, we delete on other side !')
#If event is not deleted ! #If event is not deleted !
elif self.OE.status and self.GG.status: elif self.OE.status and (self.GG.status or not is_owner):
if self.OE.update.split('.')[0] != self.GG.update.split('.')[0]: if self.OE.update.split('.')[0] != self.GG.update.split('.')[0]:
if self.OE.update < self.GG.update: if self.OE.update < self.GG.update:
tmpSrc = 'GG' tmpSrc = 'GG'