diff --git a/addons/spreadsheet/static/src/pivot/pivot_functions.js b/addons/spreadsheet/static/src/pivot/pivot_functions.js index 71933b4336f..789e710ac7e 100644 --- a/addons/spreadsheet/static/src/pivot/pivot_functions.js +++ b/addons/spreadsheet/static/src/pivot/pivot_functions.js @@ -47,7 +47,8 @@ const ODOO_FILTER_VALUE = { args: [arg("filter_name (string)", _t("The label of the filter whose value to return."))], category: "Odoo", compute: function (filterName) { - return this.getters.getFilterDisplayValue(filterName); + const unEscapedFilterName = toString(filterName).replaceAll('\\"', '"'); + return this.getters.getFilterDisplayValue(unEscapedFilterName); }, returns: ["STRING"], }; diff --git a/addons/spreadsheet/static/tests/global_filters/global_filters_model_test.js b/addons/spreadsheet/static/tests/global_filters/global_filters_model_test.js index fe88ca7edbf..5614733ace0 100644 --- a/addons/spreadsheet/static/tests/global_filters/global_filters_model_test.js +++ b/addons/spreadsheet/static/tests/global_filters/global_filters_model_test.js @@ -944,6 +944,21 @@ QUnit.module("spreadsheet > Global filters model", {}, () => { assert.verifySteps(["read_1", "read_2"]); }); + QUnit.test( + "ODOO.FILTER.VALUE with escaped quotes in the filter label", + async function (assert) { + const model = await createModelWithDataSource(); + await addGlobalFilter(model, { + id: "42", + type: "text", + label: 'my "special" filter', + defaultValue: "Jean-Jacques", + }); + setCellContent(model, "A1", '=ODOO.FILTER.VALUE("my \\"special\\" filter")'); + assert.equal(getCellValue(model, "A1"), "Jean-Jacques"); + } + ); + QUnit.test( "ODOO.FILTER.VALUE formulas are updated when filter label is changed", async function (assert) {