[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.

   <field name="stage_id" string="Stage" type="row"/>

an error was raised "TypeError: measures[name] is undefined"

closes odoo/odoo#42971

X-original-commit: de1dbc9bfba3ec205c75590d3e38b20d30b39c39
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
malex-emesa
2020-01-08 15:47:09 +00:00
committed by Martin Trigaux
parent 1761a5c501
commit b02c46c5ae
2 changed files with 12 additions and 1 deletions
@@ -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) {
+11
View File
@@ -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