问题
I tried to create custom user groups to my custom module to make it appear on the top menu by following this thread Odoo 10 : Custom module doesn't appear in top black menu after installation
Module name :simcard
model name : simcard.simcard
my csv file :
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
demo_admin, Model admin access,simcard.model_simcard_simcard,simcard.group_manager,1,1,1,1
demo_user, Model user access,simcard.model_simcard_simcard,simcard.group_user,0,0,0,0
my user_groups.xml :
<odoo>
<data>
<record model="ir.module.category" id="module_management">
<field name="name">Simcard</field>
<field name="description">User access level for this module</field>
<field name="sequence">3</field>
</record>
<record id="group_user" model="res.groups">
<field name="name">User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="category_id" ref="simcard.module_management"/>
</record>
<record id="group_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('simcard.group_user'))]"/>
<field name="category_id" ref="simcard.module_management"/>
</record>
</data>
</odoo>
when i start my odoo as ./odoo-bin -u simcard , i get below error which i dont understand :
[12/Oct/2018 08:41:34] "POST /longpolling/poll HTTP/1.1" 500 -
2018-10-12 08:41:34,354 470 ERROR Dev-DB werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 180, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 168, in execute
application_iter = app(environ, start_response)
File "/odoo/odoo-server/odoo/service/server.py", line 244, in app
return self.app(e, s)
File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 186, in application
return application_unproxied(environ, start_response)
File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 172, in application_unproxied
result = handler(environ, start_response)
File "/odoo/odoo-server/odoo/http.py", line 1326, in __call__
return self.dispatch(environ, start_response)
File "/odoo/odoo-server/odoo/http.py", line 1300, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 591, in __call__
return self.app(environ, start_response)
File "/odoo/odoo-server/odoo/http.py", line 1482, in dispatch
odoo.registry(db).check_signaling()
File "/odoo/odoo-server/odoo/__init__.py", line 52, in registry
return modules.registry.Registry(database_name)
File "/odoo/odoo-server/odoo/modules/registry.py", line 59, in __new__
return cls.new(db_name)
File "/odoo/odoo-server/odoo/modules/registry.py", line 83, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/odoo/modules/loading.py", line 373, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/odoo/odoo-server/odoo/modules/loading.py", line 270, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/odoo/odoo-server/odoo/modules/loading.py", line 182, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/odoo/odoo-server/odoo/modules/loading.py", line 96, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/odoo/odoo-server/odoo/tools/convert.py", line 845, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/odoo/odoo-server/odoo/tools/convert.py", line 915, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/odoo/odoo-server/odoo/tools/convert.py", line 796, in parse
self.parse(rec, mode)
File "/odoo/odoo-server/odoo/tools/convert.py", line 799, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/odoo/odoo-server/odoo/tools/convert.py", line 707, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "/odoo/odoo-server/odoo/addons/base/ir/ir_model.py", line 1197, in _update
record.write(values)
File "/odoo/odoo-server/odoo/addons/base/res/res_users.py", line 724, in write
self._update_user_groups_view()
File "/odoo/odoo-server/odoo/addons/base/res/res_users.py", line 786, in _update_user_groups_view
view.with_context(lang=None).write({'arch': xml_content, 'arch_fs': False})
File "/odoo/odoo-server/odoo/addons/base/ir/ir_ui_view.py", line 380, in write
return super(View, self).write(self._compute_defaults(vals))
File "/odoo/odoo-server/odoo/models.py", line 3586, in write
field.determine_inverse(records)
File "/odoo/odoo-server/odoo/fields.py", line 1046, in determine_inverse
getattr(records, self.inverse)()
File "/odoo/odoo-server/odoo/addons/base/ir/ir_ui_view.py", line 220, in _inverse_arch
view.write(data)
File "/odoo/odoo-server/odoo/addons/base/ir/ir_ui_view.py", line 380, in write
return super(View, self).write(self._compute_defaults(vals))
File "/odoo/odoo-server/odoo/models.py", line 3568, in write
self._write(old_vals)
File "/odoo/odoo-server/odoo/models.py", line 3732, in _write
self._validate_fields(vals)
File "/odoo/odoo-server/odoo/models.py", line 1081, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
ParseError: "Error while validating constraint
Field `ignore_on_api` does not exist
Error context:
View `res.users.groups`
[view_id: 155, xml_id: base.user_groups_view, model: res.users, parent_id: 152]
None" while parsing /odoo/odoo-server/addons/simcard/security/user_groups.xml:37, near
<record id="group_simcard_user" model="res.groups">
<field name="name">Officer2</field>
<field name="category_id" ref="base.module_category_human_resources"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="comment">the user will be able to approve document created by employees.</field>
</record>
This ignore_on_api field exists in res.partner and user tables. I believe this is not the source of the error because when i remove users_groups.xml then this error is gone.
Info : Same module is installed on another odoo on another machine and it doesn't give any error.
Any idea what should i do for this error?
来源:https://stackoverflow.com/questions/52760293/odoo-10-secure-access-to-custom-module