Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2838 Zobrazení

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
Zrušit
Nejlepší odpověď

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

It won't be backward compatible

Avatar
Zrušit
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

Related Posts Odpovědi Zobrazení Aktivita
1
zář 23
1751
1
pro 23
1403
1
kvě 25
2441
1
dub 25
3461
1
dub 25
4284