diff --git a/addons/spreadsheet/static/src/list/list_data_source.js b/addons/spreadsheet/static/src/list/list_data_source.js index 217afcd58dc..9b587e7d528 100644 --- a/addons/spreadsheet/static/src/list/list_data_source.js +++ b/addons/spreadsheet/static/src/list/list_data_source.js @@ -85,6 +85,7 @@ export class ListDataSource extends OdooViewsDataSource { spec[field.name] = {}; spec[field.currency_field] = { fields: { + ...spec[field.currency_field]?.fields, name: {}, // currency code symbol: {}, decimal_places: {}, @@ -95,7 +96,12 @@ export class ListDataSource extends OdooViewsDataSource { case "many2one": case "many2many": case "one2many": - spec[field.name] = { fields: { display_name: {} } }; + spec[field.name] = { + fields: { + display_name: {}, + ...spec[field.name]?.fields, + }, + }; break; default: spec[field.name] = field; diff --git a/addons/spreadsheet/static/tests/lists/list_plugin_test.js b/addons/spreadsheet/static/tests/lists/list_plugin_test.js index 26c5f61385d..a0cb9363edb 100644 --- a/addons/spreadsheet/static/tests/lists/list_plugin_test.js +++ b/addons/spreadsheet/static/tests/lists/list_plugin_test.js @@ -549,6 +549,34 @@ QUnit.module("spreadsheet > list plugin", {}, () => { }); }); + QUnit.test( + "list with both a monetary field and the related currency field", + async function (assert) { + const { model } = await createSpreadsheetWithList({ + columns: ["pognon", "currency_id"], + }); + setCellContent(model, "A1", '=ODOO.LIST(1, 1, "pognon")'); + setCellContent(model, "A2", '=ODOO.LIST(1, 1, "currency_id")'); + await waitForDataSourcesLoaded(model); + assert.strictEqual(getEvaluatedCell(model, "A1").formattedValue, "74.40€"); + assert.strictEqual(getEvaluatedCell(model, "A2").value, "EUR"); + } + ); + + QUnit.test( + "list with both a monetary field and the related currency field", + async function (assert) { + const { model } = await createSpreadsheetWithList({ + columns: ["currency_id", "pognon"], + }); + setCellContent(model, "A1", '=ODOO.LIST(1, 1, "pognon")'); + setCellContent(model, "A2", '=ODOO.LIST(1, 1, "currency_id")'); + await waitForDataSourcesLoaded(model); + assert.strictEqual(getEvaluatedCell(model, "A1").formattedValue, "74.40€"); + assert.strictEqual(getEvaluatedCell(model, "A2").value, "EUR"); + } + ); + QUnit.test( "List record limit is computed during the import and UPDATE_CELL", async function (assert) {