如何为odoo中的管理员以外的用户创建用户表单

时间:2018-07-30 13:36:34

标签: odoo-9 odoo-view

我在应用程序odoo中创建了一个新用户,我希望授予他仅创建新用户的权利,为res.users和新组创建了新菜单和操作

<!-- Administrator group in establishments -->
<record id="administrator_group_rules" model="res.groups">
    <field name="name">مدير التطبيقة في المؤسسة</field>
    <field name="comment">This is a group of administrators in every establishments</field>
    <field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

<!-- Tree for admin user to create a new user -->

    <record id="tree_res_users_administrator" model="ir.ui.view">
        <field name="model">res.users</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name"/>
                <field name="login"/>
                <field name="lang"/>
                <field name="login_date"/>
            </tree>
        </field>
    </record>

<!--Form for admin user to create a new user-->
    <record id="form_res_users_administrator" model="ir.ui.view">
        <field name="model">res.users</field>
        <field name="inherit_id" ref="base.view_users_form"/>
        <!--<field name="groups_id" eval="[(6, 0, [ref('administrator_group_rules')])]"/>-->
        <field name="arch" type="xml">
            <xpath expr="//field[@name='groups_id']" position="attributes">
                <attribute name="domain">[('gid','=',1)]</attribute>
            </xpath>
        </field>
    </record>

<!-- Action for admin user to create a new user -->

    <record id="action_res_users_administrator" model="ir.actions.act_window">
        <field name="name">المستخدمون</field>
        <field name="res_model">res.users</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_ids"
               eval="
                        [
                        (5, 0, 0),
                        (0, 0, {'view_mode': 'tree', 'view_id': ref('tree_res_users_administrator')}),
                        (0, 0, {'view_mode': 'form', 'view_id': ref('form_res_users_administrator')}),
                        ]"
        />
        <field name="domain">[('id','!=',1)]</field>
        <field name="context">{}</field>
    </record>

    <!-- Menu for admin user to create a new user -->

    <menuitem id="menu_res_users_administrator" name="المستخدمون" action="action_res_users_administrator" groups="administrator_group_rules"/>

但显示此错误

AttributeError: Field `sel_groups_16_17_18` does not exist

错误上下文: 查看res.users.form [view_id:151,xml_id:form_res_users_administrator,型号:res.users,parent_id:??? ????]

0 个答案:

没有答案