From eb9f72ba627a7d859951d84c9372a6c3db2c75a0 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 6 Apr 2018 14:05:15 +0200 Subject: [PATCH] [FIX] web_calendar: unlink parsed id The id of the record may be a real database id or a string containing a virtual id (e.g. "42-20380119031417"). The id is always stored as a string but must be converted to int when sent to the ORM (to avoid self.browse('42')) The calendar modules do handle correctly virtual ids in its unlink method but it is not the case of the other modules that are expecting integers. Convert to int if we are working with real ids Replace and closes #22115 --- addons/web_calendar/static/src/js/web_calendar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index 18cca729b56..529727cbd2f 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -917,9 +917,10 @@ var CalendarView = View.extend({ } } else { + var res_id = parseInt(id).toString() === id ? parseInt(id) : id; new form_common.FormViewDialog(this, { res_model: this.model, - res_id: parseInt(id).toString() === id ? parseInt(id) : id, + res_id: res_id, context: this.dataset.get_context(), title: title, view_id: +this.open_popup_action, @@ -931,7 +932,7 @@ var CalendarView = View.extend({ }}, {text: _t("Delete"), close: true, click: function() { - self.remove_event(id); + self.remove_event(res_id); }}, {text: _t("Close"), close: true}