summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorKhoi Nguyen <bng@odoo.com>2017-08-29 10:59:25 +0200
committerKhoi Nguyen <bng@odoo.com>2017-08-29 11:41:32 +0200
commit5149e18ec704df151c03d3b1e35d5f04328b89d3 (patch)
treef2d1cf48d7df2c88e501efa30004ab3faabdebf9 /addons/web/static/tests/fields/basic_fields_tests.js
parentd93726f9ac6d64a39cd95f35cf61a898e4cd2009 (diff)
[FIX] web: always display handle widget
Before this commit, a list containing a handle widget would only display the handles associated with non-zero integer values. This is due to the fact that unset fields are hidden in Odoo, while a field is by default considered 'defined' if its value is truthy. We override the isSet method for the handle widget to always return true. This tells the handle widget that the associated integer value is always defined, thereby ensuring that the handle will always be shown.
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index f851ad60115..984fa156d9c 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -1578,6 +1578,24 @@ QUnit.module('basic_fields', {
form.destroy();
});
+ QUnit.test('handle widget with falsy values', function (assert) {
+ assert.expect(1);
+
+ var list = createView({
+ View: ListView,
+ model: 'partner',
+ data: this.data,
+ arch: '<tree>' +
+ '<field name="sequence" widget="handle"/>' +
+ '<field name="display_name"/>' +
+ '</tree>',
+ });
+
+ assert.strictEqual(list.$('.o_row_handle:visible').length, this.data.partner.records.length,
+ 'there should be a visible handle for each record');
+ list.destroy();
+ });
+
QUnit.module('FieldDate');