我有一些问题 :
- 保存记录(在创建中)方法(如成功保存记录)时是否可以显示警告消息。
2.我想在点击创建后从页面导航时显示警告消息,点击浏览器的某些菜单项、退格或后退按钮离开页面而不保存?
我有一些问题 :
2.我想在点击创建后从页面导航时显示警告消息,点击浏览器的某些菜单项、退格或后退按钮离开页面而不保存?
IMHO It is better to use a workflow to define the flow of process like we have a two state new and done default state is new when user create and enter all required field and click on save trigger a workflow and change state from new to done. That tell user that he complete the flow like wise you can put a state as you required. for more detail on workflow please read from http://doc.openerp.com/v6.0/developer/3_9_Workflow_Business_Process/index.html
2.I think this feature is already implemented in new upcoming version 7.0.
strong textHi 是的,您可以在通过 JS 脚本保存记录时发出警报消息,您可能必须在路径 addons/web/static/src/js/viewform.js 中编写单行代码
on_button_save: function() {
var self = this;
return this.save().done(function(result){
**if (!confirm(_t("The record has been saved"))) {
return false;
}**
self.trigger("save", result);
self.reload().then(function() {
self.to_view_mode();
var parent = self.ViewManager.ActionManager.getParent();
if(parent){
parent.menu.do_reload_needaction();
}
});
});
},