Skip to content
Snippets Groups Projects
Commit 951145dd authored by Arnaud Joset's avatar Arnaud Joset
Browse files

[IMP] web: avoid losing selection when a new quick create dialog is opended.


Before this commit, the datetime range selection was lost when the quick create dialog was opened.

closes odoo/odoo#64948

Taskid: 2342252
Related: odoo/enterprise#15915
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent ff865dc5
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ var QuickCreate = Dialog.extend({
init: function (parent, buttons, options, dataTemplate, dataCalendar) {
this._buttons = buttons || false;
this.options = options;
this.parentCalendar = parent;
// Can hold data pre-set from where you clicked on agenda
this.dataTemplate = dataTemplate || {};
this.dataCalendar = dataCalendar;
......@@ -67,6 +67,20 @@ var QuickCreate = Dialog.extend({
this.$('input').focus();
},
destroy: function () {
// On quick create, remaining dialogs may be closed. We avoid to lose the selection for new quickcreate
// by checking that the dialog is not already destroyed.
if (!this.isDestroyed()) {
// remove selection when the dialog is closed
if (this.parentCalendar.renderer.state.scale === 'year') {
this.parentCalendar.renderer.calendar.view.unselect();
} else {
this.parentCalendar.renderer.calendar.unselect();
}
}
this._super.apply(this, arguments);
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
......
......@@ -381,11 +381,6 @@ return AbstractRenderer.extend({
data.title = this.state.context.default_name;
}
this.trigger_up('openCreate', this._convertEventToFC3Event(data));
if (this.state.scale === 'year') {
this.calendar.view.unselect();
} else {
this.calendar.unselect();
}
},
/**
* Return the Object options for FullCalendar
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment