From 732f176fe1789eb513f77dfa0a671bd992db39c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Ku=CC=88hn?= Date: Wed, 22 Nov 2017 12:39:37 +0100 Subject: [FIX] web: readonly monetary field onchange currency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- addons/web/static/src/js/fields/basic_fields.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') 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 }, }); -- cgit v1.2.3