Habib (ayh)andJohn Laterre 805d2c0820 [FIX] web: monetary formatter in readonly ignores currency_field in field definition
Steps to reproduce:

Select a company whose currency is USD.
Create an invoice in EUR.
Go to the "Journal Items" tab.
The amounts in the "Debit" and "Credit" columns are correct, but the currency symbol is € (invoice currency) instead of $ (company currency).

This should not happen since both of these fields have `currency_field='company_currency_id'` in their definition:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/account/models/account_move_line.py#L90-L99

But since those fields fulfill the conditions in `canUseFormatter`:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/web/static/src/views/list/list_renderer.xml#L228-L229

`currencyField` remains undifined in the `formatOptions` when going through `getFormattedValue`:
https://github.com/odoo/odoo/blob/702adc878e897461c4c9976110cee84d397ff4af/addons/web/static/src/views/list/list_renderer.js#L722-L734

Which is why the current fix looks at `options.field.currency_field` before falling back to `currency_id` when setting `currencyField`.

A test is also added to make sure the issue does not creep back in again.

closes odoo/odoo#101995

X-original-commit: a860370b8ed73c192c652b4a97ac0aa1d1c23936
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
Co-authored-by: John Laterre (jol) <jol@odoo.com>
2022-10-03 21:23:03 +02:00
2022-09-30 09:31:52 +02:00
2022-10-03 15:18:52 +02:00
…
…
…
2021-10-07 17:59:53 +00:00
2022-01-14 15:44:52 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%