summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2017-11-22 12:39:37 +0100
committerAlexandre Kühn <aku@odoo.com>2017-11-22 14:16:00 +0100
commit732f176fe1789eb513f77dfa0a671bd992db39c9 (patch)
tree3efe547f1354c2084e194e1fee0c2af7be42745c /addons/web/static/src
parentf414b4227a80417250f4f48593d2b63af07a3c25 (diff)
[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
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index a4979848adb..7ebe94f7b30 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -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
},
});