51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
odoo.define('jikimo_test_assistant.action_clean_data_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 action_clean_data_confirm(parent, {params}) {
|
||
let message = "确认清理数据?<br/>"
|
||
message += "日期:"+ params.date + "以前<br/>"
|
||
message += "模型:" + params.model_names.join(',')
|
||
const dialog = new Dialog(parent, {
|
||
title: "确认",
|
||
$content: $('<div>').append(message),
|
||
buttons: [
|
||
{ text: "确认", classes: 'btn-primary jikimo_button_confirm', close: true, click: () => actionCleanDataConfirm(parent, params) },
|
||
{ text: "取消", close: true },
|
||
],
|
||
});
|
||
dialog.open();
|
||
|
||
|
||
async function actionCleanDataConfirm(parent, params) {
|
||
rpc.query({
|
||
model: 'jikimo.data.clean.wizard',
|
||
method: 'action_clean_data',
|
||
args: [params.active_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'},
|
||
}
|
||
});
|
||
})
|
||
|
||
}
|
||
}
|
||
|
||
core.action_registry.add('action_clean_data_confirm', action_clean_data_confirm);
|
||
return action_clean_data_confirm;
|
||
});
|