Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7983 Lượt xem

Hi all,

I created a wizard with a button. When I click to this button, I want to close the wizard and open a url in new tab. But in my case, I can only close the wizard or open url by using return in my function (not both at same time)

If want to open url, so I return my function as below

return {
            'type' : 'ir.actions.act_url',
            'url' : url,
            'target' : 'new',
        }

And if I want to close the wizard (not open url), I write

return {'type': 'ir.actions.act_window_close'} 

In other way, I tred creating other function, as below, to open url and called it before return ir.actions.act_window_close in my function. But it was not work, url could not be opened

 def _open_url(self, cr, uid, ids, url, context=None):
        return {
            'type' : 'ir.actions.act_url',
            'url' : url,
            'target' : 'new',
        }


Finally, How can I close the wizard and open url at same time in only 1 function?

Thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

hi,

odoo.define('website_sale_quote.webquote', function(require) {
"use strict";

var ajax = require('web.ajax');
ajax.jsonRpc("/shop/modals", 'call', {
'product_id': product_id,
'kwargs': {
'context': _.extend({'quantity': quantity}, weContext.get())
},
}).then(function (modals) {
var $modal = $(modals);


$modal.appendTo($form)
.modal()
.on('hidden.bs.modal', function () {
$form.removeClass('css_options'); // possibly reactivate opacity (see above)
$(this).remove();
});

$modal.on('click', '.a-submit', function (ev) {
var $a = $(this);
           
ajax.jsonRpc("/shop/temp", 'call', {
'product_id': product_id,
'quantity_qut': quantity_qut,
'dis_qut': dis_qut,
'price_qut': price_qut,
'kwargs': {
'context': _.extend({'quantity': quantity}, weContext.get())
},
}).then(function (modals) {
var $modal = $(modals);


$modal.appendTo($form)
.modal()
.on('hidden.bs.modal', function () {
$form.removeClass('css_options'); // possibly reactivate opacity (see above)
$(this).remove();
});
});
});
ajax call the controller and you write your xml part for wizard and events are
write inside the ajax $modal


thanks
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, i'm trying to do this too!

did you find any solution?



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
1228
0
thg 11 24
1845
0
thg 3 24
1745
1
thg 12 22
3843
1
thg 12 23
7753