summaryrefslogtreecommitdiff
path: root/addons/web/static/test/views/form_tests.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-04 15:08:00 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit3ff7ff3e94e4fe34ec09a45fda04f0c8de33cd32 (patch)
tree077d8ba0b7f3ba1c270e1234125d7ce8c89d012e /addons/web/static/test/views/form_tests.js
parenta529a928b4a295d5a834bcd8ab9a02433be6ff6a (diff)
[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.
Diffstat (limited to 'addons/web/static/test/views/form_tests.js')
-rw-r--r--addons/web/static/test/views/form_tests.js25
1 files changed, 25 insertions, 0 deletions
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: '<form string="Partners">' +
+ '<sheet>' +
+ '<field name="foo"/>' +
+ '<group attrs=\'{"invisible": [["int_field", "=", 0.0]]}\'>' +
+ '<div class="hello">this should be invisible</div>' +
+ '<field name="int_field"/>' +
+ '</group>' +
+ '</sheet>' +
+ '</form>',
+ });
+
+ 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);