[IMP] web: extract progress bar parsing code
The progress bar parsing code was inside a big block of code making it impossible to override to add custom behaviour. It is not in a separated function. Part-of: odoo/odoo#98837
This commit is contained in:
@@ -104,13 +104,7 @@ export class KanbanArchParser extends XMLParser {
|
||||
let progressAttributes = false;
|
||||
const progressBar = xmlDoc.querySelector("progressbar");
|
||||
if (progressBar) {
|
||||
const attrs = extractAttributes(progressBar, ["field", "colors", "sum_field", "help"]);
|
||||
progressAttributes = {
|
||||
fieldName: attrs.field,
|
||||
colors: JSON.parse(attrs.colors),
|
||||
sumField: fields[attrs.sum_field] || false,
|
||||
help: attrs.help,
|
||||
};
|
||||
progressAttributes = this.parseProgressBar(progressBar, fields);
|
||||
}
|
||||
|
||||
// Concrete kanban box elements in the template
|
||||
@@ -158,4 +152,14 @@ export class KanbanArchParser extends XMLParser {
|
||||
__rawArch: arch,
|
||||
};
|
||||
}
|
||||
|
||||
parseProgressBar(progressBar, fields) {
|
||||
const attrs = extractAttributes(progressBar, ["field", "colors", "sum_field", "help"]);
|
||||
return {
|
||||
fieldName: attrs.field,
|
||||
colors: JSON.parse(attrs.colors),
|
||||
sumField: fields[attrs.sum_field] || false,
|
||||
help: attrs.help,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user