下面我提到了grievance.redressal(模型),视图和访问控制列表。我试图在ir.model.access.csv中为grievance.redressal(model)添加acl。但是服务器更新时模块失败
类文件:
class grievance_redressal(models.Model):
_name = 'grievance.redressal'
name = fields.Char('Name with Initial', size=64)
查看:
<record id="view_grievance_redressal_form" model="ir.ui.view" >
<field name="name">grievance.redressal.form</field>
<field name="model">grievance.redressal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Grievance Redressal" version="7.0">
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_grievance_redressal_tree" model="ir.ui.view">
<field name="name">grievance.redressal.tree</field>
<field name="model">grievance.redressal</field>
<field name="arch" type="xml">
<tree string="Grievance Redressal">
<field name="name"/>
</tree>
</field>
</record>
<record id="action_grievance_redressal" model="ir.actions.act_window">
<field name="name">Grievance Redressal</field>
<field name="res_model">grievance.redressal</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem action="action_grievance_redressal" id="grievance_redressal_menu" parent="operations" sequence="30"/>
ACL:
access_grievance_redressal_group_officer, access.grievance.redressal.group.officer, model_grievance.redressal, group_officer 1,0,0,0
如果我试图在odoo中为新创建的模型(grievance.redressal)添加ACL。但是会抛出以下错误
File "/home/user/Projects/test/test-server/openerp/service/server.py", line 885, in preload_registries
registry = RegistryManager.new(dbname, update_module=update_module)
File "/home/user/Projects/test/test-server/openerp/modules/registry.py", line 385, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 333, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/user/Projects/test/test-server/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/user/Projects/test/test-server/openerp/tools/convert.py", line 846, in convert_file
convert_csv_import(cr, module, pathname, fp.read(), idref, mode, noupdate)
File "/home/user/Projects/test/test-server/openerp/tools/convert.py", line 914, 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 test failed: file test/security/ir.model.access.csv could not be processed:
Line 1 : model+AF8-id
csv文件:
答案 0 :(得分:1)
似乎是OpenOffice和csv文件的编码问题。您应该将文件保存为UTF-8。有关详细信息,请查看here。
答案 1 :(得分:0)
我已经解决了这个问题。问题是在libreoffice中编辑CSV有些时候失败了。当我在文本编辑器中编辑CSV文件时工作正常。感谢
我已使用文本编辑器作为编辑工具在csv中添加了ACL:
access_grievance_redressal_group_student,access.grievance.redressal.group.student,model_grievance_redressal,group_student,1,0,0,0