tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Wrong Arch Parser: Gallery for V. 17 not working

Open planctron opened this issue 4 months ago • 0 comments

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,
        };
    }
}

planctron avatar Oct 09 '24 09:10 planctron