跳至内容
菜单
此问题已终结
1 回复
2842 查看

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.

形象
丢弃
最佳答案

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

It won't be backward compatible

形象
丢弃
编写者

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

相关帖文 回复 查看 活动
1
9月 23
1755
1
12月 23
1404
1
5月 25
2444
1
4月 25
3464
1
4月 25
4291