在字段“组”

时间:2019-02-14 09:38:59

标签: odoo

请我要为我的模块建立访问权限,因此我修改了csv文件以尝试安装该模块,但是在安装模块时会出现此错误:

File "/home/omar/odoo/odoo11/odoo/modules/loading.py", line 95, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/home/omar/odoo/odoo11/odoo/tools/convert.py", line 785, in convert_file
    convert_csv_import(cr, module, pathname, fp.read(), idref, mode, noupdate)
  File "/home/omar/odoo/odoo11/odoo/tools/convert.py", line 832, in convert_csv_import
    raise Exception(_('Module loading %s failed: file %s could not be processed:\n %s') % (module, fname, warning_msg))
Exception: Module loading moduletest failed: file moduletest/security/ir.model.access.csv could not be processed:
 No matching record found for external id 'groups_group1' in field 'Group'
No matching record found for external id 'groups_group2' in field 'Group'

2 个答案:

答案 0 :(得分:2)

发生此错误的一件事是,当您不遵守安全文件的顺序时,必须将与安全相关的.xml文件放在__清单__.py中的.csv文件之前。

这是一个简单的例子:

    'data': [
        'views/security.xml',
        'security/ir.model.access.csv',
        # ... other includes ...
    ]

答案 1 :(得分:0)

这是类别和组的示例代码

 <record model="ir.module.category" id="module_category_stock_quotation_request"> -->
        <!-- <field name="parent_id" ref="module_category_localization" /> -->
        <!-- <field name="name">Stock Transfert Request</field>
        <field name="visible" eval="0" />
    </record> 


 <record id="group_stock_quotation_request_user" model="res.groups">
        <field name="name">User</field>
        <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
        <field name="category_id" ref="module_category_stock_quotation_request"/>
    </record>

    <record id="group_stock_quotation_request_manager" model="res.groups">
        <field name="name">Manager</field>
        <field name="implied_ids" eval="[(4, ref('transfert_request.group_stock_quotation_request_user'))]"/>
        <field name="category_id" ref="module_category_stock_quotation_request"/>
    </record>