[FIX] web: prevent crash in ungrouped kanban views with progressbar
The progressbar widget is not supposed to be displayed in non grouped mode. Before this commit, this situation resulted in a traceback. For example, if the user has an activity on the subscription model, and tries to open it, it will open an ungrouped kanban view. With this commit, we check first that the kanban view is in grouped mode, before loading the progress bar data.
This commit is contained in:
@@ -305,7 +305,7 @@ var KanbanModel = BasicModel.extend({
|
||||
* @override
|
||||
*/
|
||||
_load: function (dataPoint, options) {
|
||||
if (dataPoint.progressBar) {
|
||||
if (dataPoint.groupedBy.length && dataPoint.progressBar) {
|
||||
return this._readProgressBarGroup(dataPoint, options);
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
|
||||
@@ -4232,6 +4232,37 @@ QUnit.module('Views', {
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('column progressbars should not crash in non grouped views', function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
var kanban = createView({
|
||||
View: KanbanView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch:
|
||||
'<kanban>' +
|
||||
'<field name="bar"/>' +
|
||||
'<field name="int_field"/>' +
|
||||
'<progressbar field="foo" colors=\'{"yop": "success", "gnap": "warning", "blip": "danger"}\' sum_field="int_field"/>' +
|
||||
'<templates><t t-name="kanban-box">' +
|
||||
'<div>' +
|
||||
'<field name="name"/>' +
|
||||
'</div>' +
|
||||
'</t></templates>' +
|
||||
'</kanban>',
|
||||
mockRPC: function (route, args) {
|
||||
assert.step(route)
|
||||
return this._super(route, args);
|
||||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(kanban.$('.o_kanban_record').text(), 'namenamenamename',
|
||||
"should have renderer 4 records");
|
||||
|
||||
assert.verifySteps(['/web/dataset/search_read'], "no read on progress bar data is done");
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('column progressbars: creating a new column should create a new progressbar', function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user