Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2715 Vistas

hi everyone,
I am new in odoo 16 I have two buttons in portal, and when click on button then open wizard using js code, it's works fine in odoo 14 I think this js file is not work in odoo 16

odoo.define('vendor_portal_management.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');


ajax.loadXML('/vendor_portal_management/static/src/xml/vendor_portal.xml', qweb);


$('document').ready(function () {

// Import Products and Prices

$('.import_prices_vp').on('click', function (ev) {

rpc.query({

model: 'vendor.product',

method: 'return_import_configs',

context: session.user_context,

}).then(function(values) {

var select = new VendorProductImportPrices(this, {}, values);

var def = $.Deferred();

select.on('save', this, function (root) {

def.resolve(root);

});

select.open();

});

});

// Product Create

$('.create_product_vp').on('click', function (ev) {

var select = new VendorProductDialogCreate(this, {}, {});

var def = $.Deferred();

select.on('save', this, function (root) {

def.resolve(root);

});

select.open();

return def.then(function (res) {

location.reload();

})

});

}

please suggest me how to solve it.

Avatar
Descartar
Mejor respuesta

Yes, you need to migrate your code to match Odoo 16 JS, Template, Components and Widgets

It won't be backward compatible

Avatar
Descartar
Autor

Will you please suggest me how to solve this problem
regards.

Sorry to say that it's not an easy task. I have done this kind of JS migrations and it's a pain for several days. It definitely could be done but you need to understand old and new code of the process, widgets and component involved in order to make the necessary changes. Perhaps this could be an easy one... or not, but all depends on the requirements of what this JS used to solve and if that it's an issue today

Publicaciones relacionadas Respuestas Vistas Actividad
1
sept 23
1679
1
dic 23
1316
1
may 25
2107
1
abr 25
3192
1
abr 25
3974