[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.
This commit is contained in:
@@ -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:'<form string="Partners">' +
|
||||
'<sheet>' +
|
||||
'<field name="qux"/>' +
|
||||
'<field name="currency_id" invisible="1"/>' +
|
||||
'<field name="currency_id"/>' +
|
||||
'<field name="bar"/>' +
|
||||
'</sheet>' +
|
||||
'</form>',
|
||||
@@ -1372,6 +1374,12 @@ QUnit.module('basic_fields', {
|
||||
assert.strictEqual(form.$('.o_form_field_monetary > input').length, 1,
|
||||
"After the onchange, the monetary <input/> 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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user