[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
This commit is contained in:
Martin Trigaux
2018-04-06 14:31:52 +02:00
parent e5fd52d28c
commit eb9f72ba62
@@ -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}