如何让用户在草稿状态下创建记录但无法查看创建的记录?

时间:2018-03-19 11:31:58

标签: python odoo odoo-10

如何不允许某些用户查看草稿记录并创建默认处于草稿状态的记录,任何人都可以帮忙,我试试这个:

<record model="ir.rule" id="shipping_policy_cash_comp_rule">
    <field name="name">Shipping Policy multi-company</field>
    <field name="model_id" ref="model_shipping_cash"/>
    <field name="groups" eval="[(4.0, ref('custom_shipping.shipping_group_manager'))]"/>
    <field name="domain_force">[('state','!=','draft')]</field>
</record>
<record model="ir.rule" id="shipping_policy_cash_comp_main_rule">
    <field name="name">Shipping Policy multi-company</field>
    <field name="model_id" ref="model_shipping_cash"/>
    <field name="groups" eval="[(4.0, ref('custom_shipping.shipping_group_main_manager'))]"/>
    <field name="domain_force">[(1,'=',1)]</field>
</record>

The Image Here

1 个答案:

答案 0 :(得分:0)

在你的行动中这样写:

<record id="any_id" model="ir.actions.act_window">
        <field name="name"> Any Name</field>
        <field name="res_model">your.model</field>
        <field name="view_type">form</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="domain">[('state', '!=', 'draft')] </field>
</record>

或者如果您希望此函数仅应用于特定组,请将其写入security.xml文件:

<record id="your_id" model="ir.rule">
            <field name="name">Any Name</field>
            <field name="model_id" ref="model_your_model" />
            <field name="global" eval="False" />
            <field name="domain_force">[('state', '!=', 'draft')]
            </field>
            <field name="groups" eval="[(4,ref('the_module_name.group_of_that_user'))]" />
</record>