[FIX] web: Kanban: quick create several records in a row
Before this rev., when quick creating a record in a grouped kanban
view, the quick create widget wasn't automatically re-opened, which
didn't allow the user to quickly create several records in a row
(without clicking each time on the '+').
This desired behavior had been broken by rev. 1d34e26, which aimed
to properly reload the kanban column when a record was created
(e.g. column counter, progress bar...).
This commit is contained in:
@@ -355,11 +355,13 @@ var KanbanController = BasicController.extend({
|
||||
self._updateEnv();
|
||||
|
||||
var columnState = self.model.getColumn(db_id);
|
||||
return self.renderer.updateColumn(columnState.id, columnState).then(function () {
|
||||
if (event.data.openRecord) {
|
||||
self.trigger_up('open_record', {id: db_id, mode: 'edit'});
|
||||
}
|
||||
});
|
||||
return self.renderer
|
||||
.updateColumn(columnState.id, columnState, {openQuickCreate: true})
|
||||
.then(function () {
|
||||
if (event.data.openRecord) {
|
||||
self.trigger_up('open_record', {id: db_id, mode: 'edit'});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -141,15 +141,23 @@ var KanbanRenderer = BasicRenderer.extend({
|
||||
*
|
||||
* @param {string} localID the column id
|
||||
* @param {Object} columnState
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.openQuickCreate] if true, directly opens the
|
||||
* QuickCreate widget in the updated column
|
||||
*
|
||||
* @returns {Deferred}
|
||||
*/
|
||||
updateColumn: function (localID, columnState) {
|
||||
updateColumn: function (localID, columnState, options) {
|
||||
var newColumn = new KanbanColumn(this, columnState, this.columnOptions, this.recordOptions);
|
||||
var index = _.findIndex(this.widgets, {db_id: localID});
|
||||
var column = this.widgets[index];
|
||||
this.widgets[index] = newColumn;
|
||||
return newColumn.insertAfter(column.$el).then(column.destroy.bind(column));
|
||||
return newColumn.insertAfter(column.$el).then(function () {
|
||||
if (options && options.openQuickCreate) {
|
||||
newColumn.addQuickCreate();
|
||||
}
|
||||
column.destroy();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Updates a given record with its new state.
|
||||
|
||||
Reference in New Issue
Block a user