[FIX] web: Kanban: fallback on empty array for x2many raw_value

The commit e07f27d has wrongly changed the fallback for one2many raw_value from
an empty array to `false`. This modification brokes a lot of templates where we
assume that the value is always an array.

This commit restores the previous behavior with the fallback on [].
This commit is contained in:
Martin Geubelle
2017-05-04 11:58:25 +02:00
parent 34cf2bc51c
commit c6a0ff52f9
2 changed files with 2 additions and 2 deletions
@@ -368,7 +368,7 @@ var KanbanRecord = Widget.extend({
if ((r.type === 'date' || r.type === 'datetime') && value) {
r.raw_value = value.toDate();
} else if (r.type === 'one2many' || r.type === 'many2many') {
r.raw_value = value.count ? value.res_ids : false;
r.raw_value = value.count ? value.res_ids : [];
} else if (r.type === 'many2one' ) {
r.raw_value = value && value.res_id || false;
} else {
@@ -1031,7 +1031,7 @@ QUnit.module('Views', {
'<templates><t t-name="kanban-box">' +
'<div>' +
'<button t-if="!record.product_id.raw_value" class="btn_a">A</button>' +
'<button t-if="!record.category_ids.raw_value" class="btn_b">B</button>' +
'<button t-if="!record.category_ids.raw_value.length" class="btn_b">B</button>' +
'</div>' +
'</t></templates>' +
'</kanban>',