From b02c46c5aefdb337a4428341b64ebf1b771aea5b Mon Sep 17 00:00:00 2001 From: malex-emesa Date: Wed, 8 Jan 2020 13:33:40 +0000 Subject: [PATCH] [FIX] crm: check if name is present in measures Fix an error which occurs during an attempt to access the string attribute of a non existing measure If a pivot view is defined with a "string" attribute of a field of type "row", e.g. an error was raised "TypeError: measures[name] is undefined" closes odoo/odoo#42971 X-original-commit: de1dbc9bfba3ec205c75590d3e38b20d30b39c39 Signed-off-by: Martin Trigaux (mat) --- addons/web/static/src/js/views/pivot/pivot_view.js | 2 +- doc/cla/individual/malex-emesa.md | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 doc/cla/individual/malex-emesa.md diff --git a/addons/web/static/src/js/views/pivot/pivot_view.js b/addons/web/static/src/js/views/pivot/pivot_view.js index 17cc478ba9b..ab8cc5de7c8 100644 --- a/addons/web/static/src/js/views/pivot/pivot_view.js +++ b/addons/web/static/src/js/views/pivot/pivot_view.js @@ -89,7 +89,7 @@ odoo.define('web.PivotView', function (require) { if (field.attrs.type === 'measure' && !(name in measures)) { measures[name] = this.fields[name]; } - if (field.attrs.string) { + if (field.attrs.string && name in measures) { measures[name].string = field.attrs.string; } if (field.attrs.type === 'measure' || 'operator' in field.attrs) { diff --git a/doc/cla/individual/malex-emesa.md b/doc/cla/individual/malex-emesa.md new file mode 100644 index 00000000000..6da224be446 --- /dev/null +++ b/doc/cla/individual/malex-emesa.md @@ -0,0 +1,11 @@ +Netherlands, 2020-01-08 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Alexander Makarychev alexander.makarychev@emesa.nl https://github.com/malex-emesa