Odoo 10:於搜尋檢視(search view)新增搜尋欄位、分組方式

注意!以下的步驟都需要進入『開發者模式』才能進行

編輯以前請記得備份!

新增搜尋欄位

在『SO』的『客戶』樹狀檢視(Tree View)搜尋選項中,要搜尋電話、手機必須要新增自訂篩選器,相當耗時

將手機、電話欄位加入快速搜尋選項中,長期下來可以節省許多時間

首先於『客戶選單』點選『開發者選單』/『編輯搜尋檢視』,於 name 的下方加入

<separator/>
<field name="phone" string=”電話、手機” filter_domain="['|',('phone','ilike',self),('mobile','ilike',self)]"/>

這樣就會同時搜尋 phone 與 mobile 欄位了

filter_domain 最前方的 ‘|’ 就是 or Condition,兩個選項需要加一組,有三個選項則需要兩組

下方範例則是同時搜尋 city、street、street2 三個欄位

<separator/>
<field name="address" "顯示名稱" filter_domain="['|','|',('city','ilike',self),('street','ilike',self)],('street2','ilike',self)]"/>

儲存後點選 Model Data:res.partner.select

Non Updatable 勾選,未來升級時就不需要重新再做一次了

新增分組方式

在『SO』的『訂單』樹狀檢視(Tree View)搜尋選項中,要使用自訂的分組方式來分組,每次都需要手動設定

可照以下步驟將銷售團隊加入預設分組方式中,節省時間

首先於『訂單選單』點選『開發者選單』/『編輯搜尋檢視』,編輯『Inherited Viewsale.order.list.select

 <group expand="0" string="Group By">
 <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>

修改為

 <group expand="0" string="Group By">
 <filter string="Sales Team" domain="[]" context="{'group_by':'team_id'}"/>
 <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/>

儲存後點選 Model Data:sale.order.list.select

Non Updatable 勾選,未來升級時就不需要重新再做一次了