Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2931 Представления

odoo.define('module.name', function(require) {

'use strict';

var options = require('web_editor.snippets.options');

varajax = require('web.ajax');

var core = require('web.core');

var qweb = core.qweb;

var_t = core._t;

ajax.loadXML('/module/static/src/xml/cookie_bar.xml', qweb);

}

);

This is the piece of code where the error occurs.


Uncaught Promise > ajax.loadXML is not a function 

This is the error message.  Has loadXML changed into something else in odoo16? as im trying to upgrade it from odoo15  where this code worked perfectly but in 16 it does not

Аватар
Отменить
Лучший ответ

try this way:

odoo.define('module.name', function (require) {
'use strict';

var ajax = require('web.ajax');
var core = require('web.core');

var qweb = core.qweb;

// Load the XML templates
ajax.loadAsset('module.name', 'xml', '/module/static/src/xml/cookie_bar.xml', { }, qweb).then(function () {
// Templates loaded, you can now use them
var renderedTemplate = qweb.render('module.cookie_bar_template', { /* template variables */ });
// Use the rendered template as needed
});
});

Аватар
Отменить
Автор

This is exactly what i needed.Thanks

Related Posts Ответы Просмотры Активность
2
авг. 24
1581
2
сент. 23
3790
0
июл. 25
223
1
июл. 25
4980
0
июл. 25
520