Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2803 มุมมอง

odoo.define( 'vendor_portal_validation.vendor_portal' , function (require) {
'use strict' ;

var core = require( 'web.core' );
var ajax = require( 'web.ajax' );
var Dialog = require( ' web.Dialog' );
var qweb = core.qweb;
var rpc = require( "web.rpc" );
var _t = core._t;
var session = require( 'web.session' );
const {assets} = require ( '@web/core/assets' );

assets.loadXML('/vendor_portal_validation/static/src/xml/vendor_portal.xml' ).then( function () {



how to load xml  in odoo 16  js?



อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

var   xml_id="/ vendor_portal_validation /static/src/xml/vendor_portal.xml"

    function parseXML(xml_id) {

         var xml = input.responseXML || input.responseText;

         var doc;

    try {

        var parser = new DOMParser();

        doc = parser.parseFromString(xml, "application/xml");

    } catch(err) {

        doc = new ActiveXObject("Microsoft.XMLDOM");

        doc.async = false;

        doc.loadXML(xml);

    }};

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,
You can try ajax.loadAsset method and pass the template inside it.
var core = require( 'web.core' );
var ajax = require( 'web.ajax' );
var Dialog = require( ' web.Dialog' );
var qweb = core.qweb;
var rpc = require( "web.rpc" );
var _t = core._t;
var session = require( 'web.session' );
const {assets} = require ( '@web/core/assets' );
// Load the XML templates
ajax.loadAsset('vendor_portal_validation', 'xml', '/vendor_portal_validation/static/src/xml/vendor_portal.xml', { }, qweb).then(function () {
// Templates loaded, you can now use them
var renderedTemplate = qweb.render('vendor_portal_validation.template_name', { /* template variables */ });
// Use the rendered template as needed
});
});


Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 24
81
1
ธ.ค. 23
1401
0
ก.ย. 23
2099
0
ส.ค. 23
1283
0
พ.ย. 24
1605