diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-03-31 13:29:29 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | c5d5d7a0ff05d1664e50e5239e5b5efa77a032f6 (patch) | |
| tree | fc6bf94e30dc1a8627dc5ab17a6664ed39b417f6 /addons/web/static/test | |
| parent | d6d7923c679250f6091e06e9f6dcbcd4fd6230da (diff) | |
[FIX] web: monetary field was adding DOM at each rendering
Before this commit, the `render` method of the monetary field added
the <input/> and currency elements without removing the previous
ones. As this was called on each related `onchange`, the DOM was
growing at each of these changes.
Diffstat (limited to 'addons/web/static/test')
| -rw-r--r-- | addons/web/static/test/fields/basic_fields_tests.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/web/static/test/fields/basic_fields_tests.js b/addons/web/static/test/fields/basic_fields_tests.js index 287134b43a1..8cea1900c7c 100644 --- a/addons/web/static/test/fields/basic_fields_tests.js +++ b/addons/web/static/test/fields/basic_fields_tests.js @@ -1332,12 +1332,17 @@ QUnit.module('basic_fields', { list.destroy(); }); - QUnit.test('monetary field with real monetary field in model', function (assert) { - assert.expect(2); + assert.expect(3); this.data.partner.fields.qux.type = "monetary"; + this.data.partner.onchanges = { + bar: function (obj) { + obj.qux = obj.bar ? 100 : obj.qux; + }, + }; + var form = createView({ View: FormView, model: 'partner', @@ -1346,6 +1351,7 @@ QUnit.module('basic_fields', { '<sheet>' + '<field name="qux"/>' + '<field name="currency_id" invisible="1"/>' + + '<field name="bar"/>' + '</sheet>' + '</form>', res_id: 5, @@ -1362,6 +1368,10 @@ QUnit.module('basic_fields', { assert.strictEqual(form.$('.o_form_field_monetary > input').val(), "9.10", "input value in edition should only contain the value, without the currency"); + form.$('input[type="checkbox"]').click(); // Change the field on which the monetary depends + assert.strictEqual(form.$('.o_form_field_monetary > input').length, 1, + "After the onchange, the monetary <input/> should not have been duplicated"); + form.destroy(); }); |
