From b9d9c6e3bc8d3fd4bb547aadf002652bb7bb9db4 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 31 Mar 2017 14:18:22 +0200 Subject: [FIX] web: monetary should reset on currency change This reverts commit 839a07fbed4720fc71c070507c591295722df350. Indeed, the system will need the `resetOnAnyFieldChange` option as the `FieldMonetary` will need to be re-rendered if the currency changes. This does not use the `_fetchSpecialData` system as it will be refactored later and the currency can be fetched without RPC. --- addons/web/static/test/fields/basic_fields_tests.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'addons/web/static/test/fields/basic_fields_tests.js') diff --git a/addons/web/static/test/fields/basic_fields_tests.js b/addons/web/static/test/fields/basic_fields_tests.js index 8cea1900c7c..c56f694e1fe 100644 --- a/addons/web/static/test/fields/basic_fields_tests.js +++ b/addons/web/static/test/fields/basic_fields_tests.js @@ -100,10 +100,12 @@ QUnit.module('basic_fields', { }, records: [{ id: 1, + display_name: "$", symbol: "$", position: "before", }, { id: 2, + display_name: "€", symbol: "€", position: "after", }] @@ -1333,7 +1335,7 @@ QUnit.module('basic_fields', { }); QUnit.test('monetary field with real monetary field in model', function (assert) { - assert.expect(3); + assert.expect(4); this.data.partner.fields.qux.type = "monetary"; @@ -1350,7 +1352,7 @@ QUnit.module('basic_fields', { arch:'
' + '' + '' + - '' + + '' + '' + '' + '
', @@ -1372,6 +1374,12 @@ QUnit.module('basic_fields', { assert.strictEqual(form.$('.o_form_field_monetary > input').length, 1, "After the onchange, the monetary should not have been duplicated"); + var $dropdown = form.$('.o_form_field_many2one input').autocomplete('widget'); + form.$('.o_form_field_many2one input').click(); + $dropdown.find('li:not(.o_m2o_dropdown_option):last').mouseenter().click(); + assert.strictEqual(form.$('.o_form_field_monetary > span').html(), "€", + "After currency change, the monetary field currency should have been updated"); + form.destroy(); }); -- cgit v1.2.3