odoo開發筆記 -- 傳遞上下文實現列表視圖按照指定條件過濾顯示


按鈕傳遞上下文:

                <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>

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM