Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
2834 Vues

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
Ignorer
Meilleure réponse

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

It won't be backward compatible

Avatar
Ignorer
Auteur

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

Publications associées Réponses Vues Activité
1
sept. 23
1751
1
déc. 23
1403
1
mai 25
2440
1
avr. 25
3461
1
avr. 25
4281