Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
|
||||
'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
|
||||
'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
|
||||
'jikimo_frontend/static/src/js/custom_form_status_indicator.js',
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import {patch} from '@web/core/utils/patch';
|
||||
// import { Dialog } from "@web/core/dialog/dialog";
|
||||
import {_t} from "@web/core/l10n/translation";
|
||||
import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator"
|
||||
|
||||
var Dialog = require('web.Dialog');
|
||||
// var {patch} = require("web.utils") 这句话也行
|
||||
|
||||
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
||||
// 你可以重写或者添加一些方法和属性
|
||||
async _onDiscardChanges() {
|
||||
var self = this;
|
||||
Dialog.confirm(this, _t("Are you sure you want to discard changes?"), {
|
||||
title: _t("Discard Changes"),
|
||||
|
||||
// confirm_callback: function () {
|
||||
// self.model.discardChanges(self.handle);
|
||||
// },
|
||||
});
|
||||
},
|
||||
|
||||
async discard() {
|
||||
// if (window.confirm("Are you sure you want to discard changes?")) {
|
||||
// await this.props.discard();
|
||||
// }
|
||||
const result = await this._confirmDiscardChange();
|
||||
await this.props.discard();
|
||||
},
|
||||
|
||||
_confirmDiscardChange(){
|
||||
var self = this;
|
||||
var def = new Promise(function (resolve, reject) {
|
||||
var message = _t("请确认是否要舍弃之前的更改?");
|
||||
var dialog = Dialog.confirm(self, message, {
|
||||
title: _t("Warning"),
|
||||
confirm_callback: resolve.bind(self, true),
|
||||
cancel_callback: reject,
|
||||
});
|
||||
dialog.on('closed', self, reject);
|
||||
});
|
||||
return def;
|
||||
},
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user