我正在尝试为openucat核心模块中的学生创建一个用户,并面临以下错误
我有院系,并且能够从院系中创建,但不能从学生中创建
Error:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo11/odoo/http.py", line 651, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo11/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo11/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo11/odoo/http.py", line 693, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo11/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo11/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo11/odoo/http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo11/odoo/http.py", line 937, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo11/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 938, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo11/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo11/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo11-custom-addons/openeducat_core/wizard/students_create_user_wizard.py", line 42, in create_student_user
self.env['res.users'].create_user(records, user_group)
File "/opt/odoo/odoo11-custom-addons/openeducat_core/models/res_company.py", line 51, in create_user
rec.user_id = user_id
File "/opt/odoo/odoo11/odoo/fields.py", line 980, in __set__
record.write({self.name: write_value})
File "/opt/odoo/odoo11-custom-addons/openeducat_parent/models/parent.py", line 121, in write
parent_id.name.user_id.child_ids = [(6, 0, child_ids)]
File "/opt/odoo/odoo11/odoo/fields.py", line 956, in __set__
record.ensure_one()
File "/opt/odoo/odoo11/odoo/models.py", line 4367, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: res.users()