[FIX] web: kanban quick record creation
When grouping records in kanban view, if a quick create widget was already opened, clicking on the "+" to launch another quick creation would crash. Fixes https://github.com/odoo/odoo/issues/44680 closes odoo/odoo#44949 X-original-commit: b482df17058e6f2117b616e6b152a7f2c90dc121 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -90,7 +90,7 @@ var KanbanRenderer = BasicRenderer.extend({
|
||||
},
|
||||
custom_events: _.extend({}, BasicRenderer.prototype.custom_events || {}, {
|
||||
close_quick_create: '_onCloseQuickCreate',
|
||||
cancel_quick_create: '_onCloseQuickCreate',
|
||||
cancel_quick_create: '_onCancelQuickCreate',
|
||||
set_progress_bar_state: '_onSetProgressBarState',
|
||||
start_quick_create: '_onStartQuickCreate',
|
||||
quick_create_column_updated: '_onQuickCreateColumnUpdated',
|
||||
@@ -583,6 +583,12 @@ var KanbanRenderer = BasicRenderer.extend({
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_onCancelQuickCreate: function () {
|
||||
this._toggleNoContentHelper();
|
||||
},
|
||||
/**
|
||||
* Closes the opened quick create widgets in columns
|
||||
*
|
||||
|
||||
@@ -2282,6 +2282,39 @@ QUnit.module('Views', {
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('quick create record: open on a column while another column has already one', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
var kanban = await createView({
|
||||
View: KanbanView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch: '<kanban on_create="quick_create">' +
|
||||
'<templates><t t-name="kanban-box">' +
|
||||
'<div><field name="foo"/></div>' +
|
||||
'</t></templates>' +
|
||||
'</kanban>',
|
||||
groupBy: ['product_id'],
|
||||
});
|
||||
|
||||
// Click on quick create in first column
|
||||
await testUtils.dom.click(kanban.$('.o_kanban_group:nth-child(1) .o_kanban_quick_add'));
|
||||
assert.containsOnce(kanban, '.o_kanban_quick_create');
|
||||
assert.containsOnce(kanban.$('.o_kanban_group:nth-child(1)'), '.o_kanban_quick_create');
|
||||
|
||||
// Click on quick create in second column
|
||||
await testUtils.dom.click(kanban.$('.o_kanban_group:nth-child(2) .o_kanban_quick_add'));
|
||||
assert.containsOnce(kanban, '.o_kanban_quick_create');
|
||||
assert.containsOnce(kanban.$('.o_kanban_group:nth-child(2)'), '.o_kanban_quick_create');
|
||||
|
||||
// Click on quick create in first column once again
|
||||
await testUtils.dom.click(kanban.$('.o_kanban_group:nth-child(1) .o_kanban_quick_add'));
|
||||
assert.containsOnce(kanban, '.o_kanban_quick_create');
|
||||
assert.containsOnce(kanban.$('.o_kanban_group:nth-child(1)'), '.o_kanban_quick_create');
|
||||
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('many2many_tags in kanban views', async function (assert) {
|
||||
assert.expect(12);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user