From 3ff7ff3e94e4fe34ec09a45fda04f0c8de33cd32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 4 Apr 2017 15:08:00 +0200 Subject: [FIX] web: properly evaluate unset numeric values in domain Before this commit, when a numeric value was not set (for example, a new record with no default_get value), then it was not properly evaluated as 0 in a domain. We also slightly refactored the code so we always use the same method to compute the evaluation context. --- addons/web/static/test/views/form_tests.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'addons/web/static/test') diff --git a/addons/web/static/test/views/form_tests.js b/addons/web/static/test/views/form_tests.js index d630cfd7e01..40ea74f8890 100644 --- a/addons/web/static/test/views/form_tests.js +++ b/addons/web/static/test/views/form_tests.js @@ -363,6 +363,31 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('invisible attrs with zero value in domain and unset value in data', function (assert) { + assert.expect(1); + + this.data.partner.fields.int_field.type = 'monetary'; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
' + + '' + + '' + + 'this should be invisible' + + '' + + '' + + '' + + '
', + }); + + assert.notOk(form.$('div.hello').is(':visible'), + "attrs invisible should have been computed and applied"); + form.destroy(); + }); + QUnit.test('rendering stat buttons', function (assert) { assert.expect(3); -- cgit v1.2.3