tutorials
tutorials copied to clipboard
Wrong Arch Parser: Gallery for V. 17 not working
JS source awesome_gallery/static/src/gallery_arch_parser.js causes a stall.
The import seems to be wrong (for Odoo 17.0-20240522 )
> import { XMLParser } from "@web/core/utils/xml";
XMLParser does not exist!
Possible solution:
/** @odoo-module */
import { visitXML } from "@web/core/utils/xml";
export class GalleryArchParser {
parse(xmlDoc, models, modelName) {
let imageField = 'image';
let tooltipField = 'tooltip';
let limit = 80;
visitXML(xmlDoc, (node) => {
if (node.tagName === "gallery") {
imageField = node.getAttribute("image_field");
tooltipField = node.getAttribute("tooltip_field");
limit = node.getAttribute("limit");
}
})
return {
imageField,
limit,
tooltipField,
};
}
}