odoo開發筆記 -- 傳遞上下文實現列表視圖按照指定條件過濾顯示
阿新 • • 發佈:2018-11-14
inf cor -a bsp spa import lar string oms
按鈕傳遞上下文:
<xpath expr="//div[@name=‘dec_work_sheet_id‘]" position="after"> <div class="col-lg-5 oe_button_box" name="button_box" style="width: 400px;"> <button name="%(cus_center_jiali_ext.copy_customs_declaration_action)d" type="action" class="oe_stat_button" icon="fa-align-justify" context="{‘context_name‘: name, ‘domain_dec_team_id‘: dec_team_id}" style="width: 120px !important;margin: 0px 2px -1px 0px;" string="***單復制"> </button> </div> </xpath>
視圖中加domain獲取上下文,添加過濾條件:
<record id="copy_customs_declaration_action" model="ir.actions.act_window"> <field name="name">***單復制</field> <field name="type">ir.actions.act_window</field> <field name="res_model">cus_center_new.customs_dec</field> <field name="view_mode">tree,form</field> <field name="domain">[(‘dec_team_id‘, ‘=‘, domain_dec_team_id)]</field> </record>
odoo開發筆記 -- 傳遞上下文實現列表視圖按照指定條件過濾顯示