0

我有一些问题 :

  1. 保存记录(在创建中)方法(如成功保存记录)时是否可以显示警告消息。

2.我想在点击创建后从页面导航时显示警告消息,点击浏览器的某些菜单项、退格或后退按钮离开页面而不保存?

4

2 回答 2

1
  1. I can't understand why you want to show a warning message on save when everything is goes fine. Warning message is shown when something goes wrong or user break a rule eg. when user don't have a right to create a record of particular object and user try to create a record.

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.

于 2012-11-03T06:41:29.330 回答
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();
            }
        });
    });
},
于 2014-07-09T11:33:37.100 回答