Skip to content
Snippets Groups Projects
Commit 8af2dbb0 authored by Achraf (abz)'s avatar Achraf (abz)
Browse files

[FIX] manufacture: Automation rules raise traceback


Issue

    - Install `Manufacture` and `Purchase`
    - Go to `Manufacture`
    - Enable Studio
    - Create new rules
    - Select `Purchase Order` model
    - Try to select autocomplete proposition with `Deliver to` field

    Traceback raised.

Cause

    The _search function does not return indexable value.

Solution

  Cast _search to a list.

  PS: search can be used (instead of _search) to get iterable value.

opw-2357391

closes odoo/odoo#59812

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent bd95b717
Branches
Tags
No related merge requests found
......@@ -662,10 +662,10 @@ class IrServerObjectLines(models.Model):
try:
value = int(value)
if not self.env[line.col1.relation].browse(value).exists():
record = self.env[line.col1.relation]._search([], limit=1)
record = list(self.env[line.col1.relation]._search([], limit=1))
value = record[0] if record else 0
except ValueError:
record = self.env[line.col1.relation]._search([], limit=1)
record = list(self.env[line.col1.relation]._search([], limit=1))
value = record[0] if record else 0
line.resource_ref = '%s,%s' % (line.col1.relation, value)
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment