0

我有一个按钮如下:

<button string="View Cancelled Applications" name="%(action_recruit_application)d" type="action" domain="[('state','=','cancel')]"/>

动作如下:

<record model="ir.actions.act_window" id="action_recruit_application">
    <field name="name">Applications</field>
    <field name="res_model">recruit.application</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="search_view_id" ref="view_recruit_application_search"/>
   </record>

最后搜索视图如下:

    <record model="ir.ui.view" id="view_recruit_application_search">
    <field name="name">recruit.application.search</field>
    <field name="model">recruit.application</field>
    <field name="arch" type="xml">
        <search string="Applications">
            <field name="application_id"/>
            <field name="name"/>     
            <field name="application_date"/>
            <field name="state"/>
        </search>
    </field>
</record>

我似乎无法将“状态”=“取消”传递给搜索视图。

有人可以帮我吗?

提前致谢。

4

1 回答 1

1

尝试在按钮中添加上下文。例如

<button string="View Cancelled Applications" name="%(action_recruit_application)d" type="action" domain="[('state','=','cancel')]" context="{'search_default_state':'cancel'}"/>
于 2013-06-27T12:57:09.070 回答