OE 之搜索效率问题
-
先看一段search的代码
<br /><record model="ir.ui.view" id="dispatch_work_order_filter"><br /><field name="name">dispatch.work_order.filter</field><br /><field name="model">dispatch.work_order</field><br /><field name="type">search</field><br /><field name="arch" type="xml"><br /><search string="工单"><br /><field name="name"/><br /><field name="customer"/><br /><field name="mobile"/><br /><field name="phone"/><br /><field name="address"/><br /><field name="service_card"/><br /><field name="brand"/><br /><field name="series_number"/><br /><field name="area"/><br /><field name="client_source"/><br /><field name="buy_address"/><br /><field name="engineer"/><br /><field name="department"/><br /><field name="note"/><br /><field name="check_result"/><br /><field name="measure"/><br /><field name="description_of_fault"/><br /><field name="bill_date" string="开单日期等于" filter_domain="[('bill_date','=',self)]"/><br /><field name="bill_date" string="开单日期大于" filter_domain="[('bill_date','>',self)]"/><br /><separator/><br /><field name="bill_date" string="开单日期小于" filter_domain="[('bill_date','<',self)]"/><br /><field name="appointment_date" string="预约日期等于" filter_domain="[('appointment_date','=',self)]"/><br /><field name="appointment_date" string="预约日期大于" filter_domain="[('appointment_date','>',self)]"/><br /><separator/><br /><field name="appointment_date" string="预约日期小于" filter_domain="[('appointment_date','<',self)]"/><br /><field name="visit_time" string="回访日期等于" filter_domain="[('appointment_date','=',self)]"/><br /><field name="visit_time" string="回访日期大于" filter_domain="[('appointment_date','>',self)]"/><br /><separator/><br /><field name="visit_time" string="回访日期小于" filter_domain="[('appointment_date','<',self)]"/><br /><field name="done_date" string="完工日期等于" filter_domain="[('done_date','=',self)]"/><br /><field name="done_date" string="完工日期大于" filter_domain="[('done_date','>',self)]"/><br /><separator/><br /><field name="done_date" string="完工日期小于" filter_domain="[('done_date','<',self)]"/><br /><field name="bill_month"/><br /><field name="create_uid"/><br /><field name="done_month"/><br /><separator/><br /><filter icon="terp-check" domain="[('state','=','draft')]" string="待派工" name="done0"/><br /><filter icon="ter-check" domain="[('state','=','dealing')]" string="待报工" name="dealing0"/><br /><filter icon="terp-check" domain="[('state','=','done')]" string="待交单" name="reply0"/><br /><filter icon="terp-check" domain="[('state','=','reply')]" string="待回访" name="visit0"/><br /><separator/><br /><filter icon="terp-check" domain="[('state_use_card','=','0')]" string="不扣卡" name="state_use_card0"/><br /><filter icon="terp-check" domain="[('state_use_card','=','1')]" string="需扣卡" name="state_use_card1"/><br /><separator/><br /><filter icon="terp-check" domain="[('state','=','draft')]" string="草稿" name="draft"/><br /><filter icon="terp-check" domain="[('state','=','dealing')]" string="已派工" name="dealing"/><br /><filter icon="terp-check" domain="[('state','=','done')]" string="已完工" name="done"/><br /><filter icon="terp-check" domain="[('state','=','reply')]" string="已交单" name="reply"/><br /><filter icon="terp-check" domain="[('state','=','visit')]" string="已回访" name="visit"/><br /><separator/><br /><filter icon="terp-check" domain="[('evaluate','=','very_satisfied')]" string="非常满意" name="very_satisfied"/><br /><filter icon="terp-check" domain="[('evaluate','=','satisfied')]" string="满意" name="satisfied"/><br /><filter icon="terp-check" domain="[('evaluate','=','discontent')]" string="不满" name="discontent"/><br /><filter icon="terp-check" domain="[('evaluate','=','visit')]" string="非常不满" name="very_discontent"/><br /><separator/><br /><group expand="0" string="分组"><br /><filter string="按月" icon="terp-personal" domain="[]" context="{'group_by':'bill_month'}"/><br /><filter string="客户" icon="terp-personal" domain="[]" context="{'group_by':'customer'}"/><br /><filter string="服务卡" icon="terp-personal" domain="[]" context="{'group_by':'service_card'}"/><br /><filter string="品牌型号" icon="terp-personal+" domain="[]" context="{'group_by':'brand'}"/><br /><filter string="工程师" icon="terp-personal" domain="[]" context="{'group_by':'engineer'}"/><br /><filter string="部门" icon="terp-personal+" domain="[]" context="{'group_by':'department'}"/><br /><filter string="区域" icon="terp-personal+" domain="[]" context="{'group_by':'area'}"/><br /><filter string="客户来源" icon="terp-personal+" domain="[]" context="{'group_by':'client_source'}"/><br /><filter string="购机地点" icon="terp-personal+" domain="[]" context="{'group_by':'buy_address'}"/><br /><filter string="维修类型" icon="terp-personal+" domain="[]" context="{'group_by':'warranty_type'}"/><br /><filter string="维修方式" icon="terp-personal+" domain="[]" context="{'group_by':'repair_method'}"/><br /><filter string="客户评价" icon="terp-personal+" domain="[]" context="{'group_by':'evaluate'}"/><br /><filter string="状态" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/><br /></group><br /></search><br /></field><br /></record><br />
要说明什么问题呢?
当用户数据量比较多的时候,这样的搜索视图效率就会越来越低。
原因是OE是根据输入不断的向服务器请求数据。如果用户输入速度慢,同时匹配的数据项由比较多,那么原先出于人体工学考虑的搜索就会出现卡顿现象。
有两个方法可以解决,一是search不要太复杂,二是用wizard做精准的搜索条件然后一次提交。