summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-01-19 15:31:15 +0100
committerAaron Bohy <aab@odoo.com>2018-01-22 08:32:57 +0100
commitca323c51b257b8d61d5ec9f4502a7069d5cb8489 (patch)
tree553d6b88dae193d56ff5c3c80f240ba36e0656f2 /addons/web/static/src/js
parentc4b9c51abf5c7ac47d9ead6703a9a8dd0bc59f52 (diff)
[FIX] web: Kanban: quick create in folded column
With attribute 'on_create="quick_create"' on the arch's root node, kanban views open the quick create widget in the first column when the user clicks on 'Create' (in the control panel), if the view is grouped and if there is at least one column. However, this column may be folded. Before this rev., the quick create was inserted into the folded column, which didn't look amazing. This rev. first toggles the column before inserting the quick create.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_column.js7
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_controller.js7
2 files changed, 13 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_column.js b/addons/web/static/src/js/views/kanban/kanban_column.js
index 0e50e37194f..d3553d8db12 100644
--- a/addons/web/static/src/js/views/kanban/kanban_column.js
+++ b/addons/web/static/src/js/views/kanban/kanban_column.js
@@ -167,6 +167,13 @@ var KanbanColumn = Widget.extend({
* Adds the quick create record to the top of the column.
*/
addQuickCreate: function () {
+ if (this.folded) {
+ // first open the column, and then add the quick create
+ this.trigger_up('column_toggle_fold', {
+ openQuickCreate: true,
+ });
+ return;
+ }
if (this.quickCreateWidget) {
return;
}
diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/js/views/kanban/kanban_controller.js
index 5a7cb536f43..26f379d4a39 100644
--- a/addons/web/static/src/js/views/kanban/kanban_controller.js
+++ b/addons/web/static/src/js/views/kanban/kanban_controller.js
@@ -389,13 +389,18 @@ var KanbanController = BasicController.extend({
/**
* @private
* @param {OdooEvent} event
+ * @param {boolean} [event.data.openQuickCreate=false] if true, opens the
+ * QuickCreate in the toggled column (it assumes that we are opening it)
*/
_onToggleColumn: function (event) {
var self = this;
var column = event.target;
this.model.toggleGroup(column.db_id).then(function (db_id) {
var data = self.model.get(db_id);
- self.renderer.updateColumn(db_id, data);
+ var options = {
+ openQuickCreate: !!event.data.openQuickCreate,
+ };
+ self.renderer.updateColumn(db_id, data, options);
self._updateEnv();
});
},