Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

ValueError: Expected singleton: syd_bpm.activity() #3

Open
Rafaellinos opened this issue May 19, 2020 · 0 comments
Open

ValueError: Expected singleton: syd_bpm.activity() #3

Rafaellinos opened this issue May 19, 2020 · 0 comments

Comments

@Rafaellinos
Copy link

Rafaellinos commented May 19, 2020

"""
Odoo Server Error

Traceback (most recent call last):
File "/opt/odoo12/odoo/odoo/models.py", line 4741, in ensure_one
_id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo12/odoo/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo12/odoo/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo12/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo12/odoo/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo12/odoo/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo12/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo12/odoo/odoo/http.py", line 941, in call
return self.method(*args, **kw)
File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo12/odoo/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo12/odoo/odoo/api.py", line 746, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo12/odoo/extra_addons/syd_process_maker/models/process.py", line 303, in update_processes
act.is_start_activity = True
File "/opt/odoo12/odoo/odoo/fields.py", line 1024, in set
record.ensure_one()
File "/opt/odoo12/odoo/odoo/models.py", line 4744, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: syd_bpm.activity()
"""
Using Odoo12 and Processmaker 3.3.4 CE.
On branch 12, when I try to update processes.

I solved by just checking if the search returns something:
"""

....
act = self.env['syd_bpm.activity'].search([('pm_activity_id', '=', activity['act_uid'])], limit=1)
if act:
    act.is_start_activity = True
    ....

"""
on syd_process_maker/models/process.py

I honestly didn't read all the code and don't know if that's the best solution, but it solved my problem. For some reason, this error doesn't happen on Odoo 13.

feitas referenced this issue in feitas/odoo_bpm Sep 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant