[FIX] web: archive records in a new Kanban column

Create a new column in Project, add a record and then hit 'Archive Records' : a
traceback occurs.

When creating the new column, the `groupedBy` attribute on the datapoint is set
according to the parent list datapoint, which makes no sense as the records are
not grouped inside the column.

The mentioned attribute is now removed as the records cannot be grouped inside
the column.
This commit is contained in:
Mohammed Shekha
2018-02-15 17:26:48 +01:00
committed by Martin Geubelle
parent 665496fc5c
commit e93a5cec48
2 changed files with 56 additions and 1 deletions
@@ -73,7 +73,6 @@ var KanbanModel = BasicModel.extend({
domain: parent.domain.concat([[groupBy,"=",result[0]]]),
fields: parent.fields,
fieldsInfo: parent.fieldsInfo,
groupedBy: parent.groupedBy,
isOpen: true,
limit: parent.limit,
parentID: parent.id,
@@ -1947,6 +1947,62 @@ QUnit.module('Views', {
kanban.destroy();
});
QUnit.test('archive new kanban column', function (assert) {
assert.expect(15);
this.data.partner.fields.active = {string: 'Active', type: 'char', default: true};
var kanban = createView({
View: KanbanView,
model: 'partner',
data: this.data,
arch: '<kanban>' +
'<field name="product_id"/>' +
'<templates><t t-name="kanban-box">' +
'<div><field name="foo"/></div>' +
'</t></templates>' +
'</kanban>',
groupBy: ['product_id'],
mockRPC: function (route) {
assert.step(route);
return this._super.apply(this, arguments);
},
});
var rpcs = ['/web/dataset/call_kw/partner/read_group', '/web/dataset/search_read', '/web/dataset/search_read'];
assert.strictEqual(kanban.$('.o_kanban_group').length, 2,
"there should be 2 columns");
// create a column
kanban.$('.o_column_quick_create').click();
kanban.$('.o_column_quick_create input').val('new colum');
kanban.$('.o_column_quick_create button.o_kanban_add').click();
rpcs.push('/web/dataset/call_kw/product/name_create');
assert.verifySteps(rpcs);
// add a record inside
kanban.$('.o_kanban_group:eq(2) .o_kanban_quick_add i').click();
var $quickCreate = kanban.$('.o_kanban_group:eq(2) .o_kanban_quick_create');
$quickCreate.find('input').val('new record');
$quickCreate.find('button.o_kanban_add').click();
assert.strictEqual(kanban.$('.o_kanban_group').length, 3,
"there should be 3 columns");
rpcs.push('/web/dataset/call_kw/partner/name_create');
rpcs.push('/web/dataset/call_kw/partner/read');
assert.verifySteps(rpcs);
var $newColumn = kanban.$('.o_kanban_group:eq(2)');
assert.strictEqual($newColumn.find('.o_kanban_record').length, 1,
"there should be 1 record in the new column");
$newColumn.find('.o_column_archive').click();
assert.strictEqual($newColumn.find('.o_kanban_record').length, 0,
"there should not be partners anymore");
rpcs.push('/web/dataset/call_kw/partner/write');
rpcs.push('/web/dataset/search_read');
assert.verifySteps(rpcs, "a search_read should be done after archiving the records");
kanban.destroy();
});
QUnit.test('load more records in column', function (assert) {
assert.expect(12);