This question has been flagged
1 Reply
2101 Views

While I am trying to create a USER on odoo from student Menu in openeducat Core Module It throws the Following Error


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()

Avatar
Discard
Best Answer

Hi,

Either you can report the issue to the author of the module in their GitHub or you can fix it yourself. It seems a singleton error which can be solved by using a for loop iterating over the self or by using self.ensure_one.


Also, make sure that you are using the correct version of the module in the odoo version.



Thanks

Avatar
Discard