[FIX] web: readonly monetary field onchange currency
Before this fix:
A readonly monetary field was not updating
its currency symbol when selecting another currency.
Scenario:
1. Activate multi-currency with $ (default) and €
2. In hr_expense, go to My Expenses to Submit
3. Create a new expense
4. Select 'EUR' as currency
=> Unit Price is correctly updated with €, but not Total.
With this fix:
Total displays the correct currency in edit mode.
Explanation:
Monetary fields in readonly are relying on _formatValue() to
display their value.
_formatValue() uses this.formatOptions.currency, which stores
the currency at loading of the field. We must update its value
whenever there is a change of currency.
opw-783378
This commit is contained in:
@@ -638,6 +638,7 @@ var FieldMonetary = InputField.extend({
|
||||
var currencyField = this.nodeOptions.currency_field || this.field.currency_field || 'currency_id';
|
||||
var currencyID = this.record.data[currencyField] && this.record.data[currencyField].res_id;
|
||||
this.currency = session.get_currency(currencyID);
|
||||
this.formatOptions.currency = this.currency; // _formatValue() uses formatOptions
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user