Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected singleton #98

Open
pamaillotte opened this issue Sep 22, 2023 · 1 comment
Open

Expected singleton #98

pamaillotte opened this issue Sep 22, 2023 · 1 comment
Labels

Comments

@pamaillotte
Copy link

Hello,

when task import is scheduled, there is this error :

Erreur:
Odoo Server Error

Traceback (most recent call last):
File "/var/www/odoo.example.com/odoo-13/odoo/models.py", line 5136, in ensure_one
_id, = self._ids
ValueError: too many values to unpack (expected 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/www/odoo.example.com/odoo-13/odoo/tools/safe_eval.py", line 360, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
File "/var/www/odoo.example.com/addons_community_odoo13/others/connector_jira/models/jira_backend/common.py", line 537, in _scheduler_import_project_task
self.search([]).import_project_task()
File "/var/www/odoo.example.com/addons_community_odoo13/others/connector_jira/models/jira_backend/common.py", line 478, in import_project_task
force=self.import_project_task_force,
File "/var/www/odoo.example.com/odoo-13/odoo/fields.py", line 1022, in get
record.ensure_one()
File "/var/www/odoo.example.com/odoo-13/odoo/models.py", line 5139, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: jira.backend(1, 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/var/www/odoo.example.com/odoo-13/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/var/www/odoo.example.com/odoo-13/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 915, in call
return self.method(*args, **kw)
File "/var/www/odoo.example.com/odoo-13/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/var/www/odoo.example.com/odoo-13/addons/web/controllers/main.py", line 1346, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/var/www/odoo.example.com/odoo-13/addons/web/controllers/main.py", line 1334, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/var/www/odoo.example.com/odoo-13/odoo/api.py", line 390, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/var/www/odoo.example.com/odoo-13/odoo/api.py", line 377, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/addons/base/models/ir_cron.py", line 83, in method_direct_trigger
cron.with_user(cron.user_id).with_context(lastcall=cron.lastcall).ir_actions_server_id.run()
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/addons/base/models/ir_actions.py", line 537, in run
res = func(action, eval_context=eval_context)
File "/var/www/intranet.evolutis.fr/odoo-13/addons/website/models/ir_actions.py", line 59, in run_action_code_multi
res = super(ServerAction, self).run_action_code_multi(action, eval_context)
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/addons/base/models/ir_actions.py", line 422, in run_action_code_multi
safe_eval(action.sudo().code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/tools/safe_eval.py", line 383, in safe_eval
pycompat.reraise(ValueError, ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr)), exc_info[2])
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/tools/pycompat.py", line 13, in reraise
raise value.with_traceback(tb)
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/tools/safe_eval.py", line 360, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
File "/var/www/intranet.evolutis.fr/addons_community_odoo13/others/connector_jira/models/jira_backend/common.py", line 537, in _scheduler_import_project_task
self.search([]).import_project_task()
File "/var/www/intranet.evolutis.fr/addons_community_odoo13/others/connector_jira/models/jira_backend/common.py", line 478, in import_project_task
force=self.import_project_task_force,
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/fields.py", line 1022, in get
record.ensure_one()
File "/var/www/intranet.evolutis.fr/odoo-13/odoo/models.py", line 5139, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: <class 'ValueError'>: "Expected singleton: jira.backend(1, 2)" while evaluating
'model._scheduler_import_project_task()'

It seems that an array is send where a singleton is expected.

@simahawk
Copy link
Contributor

Seems like all the scheduler methods here https://github.com/OCA/connector-jira/blob/f1761d2a133942192deff7178e5f5534658408b7/connector_jira/models/jira_backend/common.py#L545C1-L545C1 should loop on the found records.

Feel free to open a PR to fix it 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants