2013-03-28 33 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 

我想把它做成一個模塊,因爲編輯源代碼不是很好維護。