Skip to content

Commit

Permalink
[IMP] web_kanban: allow column creation on custom model
Browse files Browse the repository at this point in the history
In the kanban view, if the default_group_by is a many2one, it's possible
to quick create a new column (which will create a new record in the
relation model).

However, the field `name` was hardcoded during the creation, which means
that a custom model with `x_name` couldn't be correctly created.

This commit allows it by using `name_create` instead.
  • Loading branch information
mgeubelle committed Mar 29, 2017
1 parent e05333f commit 1a2c05e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/web_kanban/static/src/js/kanban_view.js
Expand Up @@ -737,14 +737,15 @@ var KanbanView = View.extend({
add_new_column: function (event) {
var self = this;
var model = new Model(this.relation, this.search_context);
model.call('create', [{name: event.data.value}], {
var name = event.data.value;
model.call('name_create', [name], {
context: this.search_context,
}).then(function (id) {
}).then(function (result) {
var dataset = new data.DataSetSearch(self, self.model, self.dataset.get_context(), []);
var group_data = {
records: [],
title: event.data.value,
id: id,
id: result[0],
attributes: {folded: false},
dataset: dataset,
values: {},
Expand Down

0 comments on commit 1a2c05e

Please sign in to comment.