2013-03-28 32 views
2

朋友, 需要删除从弹出manyone领域这个选项。 。我用widget="selection"。后来我domain filter不working.so(并非在所有fields。有些领域需要删除此功能),请帮我找到一个解决方案。OpenERP的帮我删除此

Create and Edit option

回答

2

没有为openerp 6.1一个模块从many2one字段的默认选择删除创建和编辑选项(在openerp应用网站搜索网络中删除)。你可以用这个例子来创建你自己的模块。或者您可以修改转到您服务器的基本代码,然后导航至openerp/addons/web/static/src/js/view_form.js并删除从行号2860定义的快速创建功能。

这是我在openerp帮助网站已经给出了相同的答案。

+0

感谢AnomA..i从openerp 1 :-)中移除了网页 –

2

我也面临同样的问题,但我很容易地解决它。

你需要改变你的web插件。

请按照下列步骤:

  1. 转到:网络/静态/ src目录/ JS

  2. 打开文件:view_form.js

  3. 转到行号2958,也可以找到label: _t(“Create and Edit ...”),

  4. 评论吧

享受,现在您可以在您的many2one领域看不必“创建和编辑”

注意:这会影响到每一个many2one场。

0

V7中可以使用的答案作为http://help.openerp.com/question/16498/how-to-disable-create-and-edit-from-from-a-menu/

<form string="My form" create="false"> 

我虽然曾在V6.1这个问题的建议,所以我创建了一个新的选择,这样我可以把它应用到只有某些领域(不所有字段由@Bipin建议)

<form string="My form" options='{"no_create": true}'> 

和改变网络/静态/ src目录/ JS/view_form.js

 // Hack: check for new "no_create" option: 
    if (self.get_definition_options().no_create === undefined || !self.get_definition_options().no_create) { 
    // the rest of the code stays asis: 

     // quick create 
     var raw_result = _(data.result).map(function(x) {return x[1];}); 
     if (search_val.length > 0 && 
      !_.include(raw_result, search_val) && 
      (!self.value || search_val !== self.value[1])) { 
      values.push({label: _.str.sprintf(_t('<em>   Create "<strong>%s</strong>"</em>'), 
        $('<span />').text(search_val).html()), action: function() { 
       self._quick_create(search_val); 
      }}); 
     } 
     // create... 
     values.push({label: _t("<em>   Create and Edit...</em>"), action: function() { 
      self._change_int_value(null); 
      self._search_create_popup("form", undefined, {"default_name": search_val}); 
     }}); 

    } // here endith the hack 

我想把它做成一个模块,因为编辑源代码不是很好维护。