51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
odoo.define('sf_manufacturing.agv_scheduling_button_confirm', function (require) {
|
|
const core = require('web.core');
|
|
const ajax = require('web.ajax');
|
|
const Dialog = require('web.Dialog');
|
|
var rpc = require('web.rpc');
|
|
var _t = core._t;
|
|
|
|
async function agv_scheduling_cancel_confirm(parent, {params}) {
|
|
const dialog = new Dialog(parent, {
|
|
title: "确认",
|
|
$content: $('<div>').append("工件正在配送中,确定取消"),
|
|
buttons: [
|
|
{ text: "确认", classes: 'btn-primary', close: true, click: () => dispatchConfirmed(parent, params) },
|
|
{ text: "取消", close: true },
|
|
],
|
|
});
|
|
dialog.open();
|
|
|
|
|
|
async function dispatchConfirmed(parent, params) {
|
|
rpc.query({
|
|
model: 'sf.agv.scheduling',
|
|
method: 'button_cancel',
|
|
args: [params.agv_scheduling_id],
|
|
kwargs: {
|
|
context: params.context,
|
|
}
|
|
}).then(res => {
|
|
parent.services.action.doAction({
|
|
'type': 'ir.actions.client',
|
|
'tag': 'display_notification',
|
|
'target': 'new',
|
|
'params': {
|
|
'message': '取消成功!',
|
|
'type': 'success',
|
|
'sticky': false,
|
|
'next': {'type': 'ir.actions.act_window_close'},
|
|
}
|
|
});
|
|
parent.services.action.doAction({
|
|
'type': 'ir.actions.client',
|
|
'tag': 'reload',
|
|
});
|
|
})
|
|
}
|
|
}
|
|
|
|
core.action_registry.add('agv_scheduling_cancel_confirm', agv_scheduling_cancel_confirm);
|
|
return agv_scheduling_cancel_confirm;
|
|
});
|