summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Widart <awt@odoo.com>2021-01-21 15:29:36 +0000
committerAdrien Widart <awt@odoo.com>2021-01-22 08:08:14 +0000
commit47bfdf0592a5dd93870ca1a9da326351d70087bb (patch)
tree9fa9e22caf393deac582d47f6f3cfdd778aa6105
parentf332541bc84d6110c90d4c5e736892f185fff3df (diff)
[FIX] google_calendar: enable the event deletion
When using the Calender synced with Google, if the user tries to delete an event, an error message is displayed: he has to archive it instead. To reproduce the error: 1. Sync Odoo Calendar with Gogle Calendar 2. Add an event 3. Click on it > Delete Error: UserError message: "You cannot delete a record synchronized with Google Calendar, archive it instead" To make the flow simpler and faster, when clicking on "Delete", the server will archive the event. When archiving an event, the server deletes the corresponding event on Google Calendar. As a result, the next time the user loads his Odoo Calendar, the sync Google->Odoo will delete the archived event. OPW-2440339 closes odoo/odoo#64874 Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
-rw-r--r--addons/google_calendar/i18n/google_calendar.pot12
-rw-r--r--addons/google_calendar/models/google_sync.py6
2 files changed, 7 insertions, 11 deletions
diff --git a/addons/google_calendar/i18n/google_calendar.pot b/addons/google_calendar/i18n/google_calendar.pot
index e76e934fbf7..629573f0c7c 100644
--- a/addons/google_calendar/i18n/google_calendar.pot
+++ b/addons/google_calendar/i18n/google_calendar.pot
@@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-27 11:24+0000\n"
-"PO-Revision-Date: 2020-11-27 11:24+0000\n"
+"PO-Revision-Date: 2021-01-22 08:05+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -365,14 +365,6 @@ msgid "Users"
msgstr ""
#. module: google_calendar
-#: code:addons/google_calendar/models/google_sync.py:0
-#, python-format
-msgid ""
-"You cannot delete a record synchronized with Google Calendar, archive it "
-"instead."
-msgstr ""
-
-#. module: google_calendar
#. openerp-web
#: code:addons/google_calendar/static/src/js/google_calendar.js:0
#, python-format
diff --git a/addons/google_calendar/models/google_sync.py b/addons/google_calendar/models/google_sync.py
index 7fcb66f50b2..c5c549b752f 100644
--- a/addons/google_calendar/models/google_sync.py
+++ b/addons/google_calendar/models/google_sync.py
@@ -104,7 +104,11 @@ class GoogleSync(models.AbstractModel):
synced.write({self._active_name: False})
self = self - synced
elif synced:
- raise UserError(_("You cannot delete a record synchronized with Google Calendar, archive it instead."))
+ # Since we can not delete such an event (see method comment), we archive it.
+ # Notice that archiving an event will delete the associated event on Google.
+ # Then, since it has been deleted on Google, the event is also deleted on Odoo DB (_sync_google2odoo).
+ self.action_archive()
+ return True
return super().unlink()
@api.model