mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[FIX] base_import_match: "Unable to use a closed cursor"
Cached methods should never return recordsets, which are tied to specific context, env, cursor, uid. Instead, they should return IDs which, later, can be browsed in the current context. With this change _usable_rules() cached method is now returing ids instead of a recordset, and also the _match_find method is properly browsing the results ids of the cached method.
This commit is contained in:
committed by
anjeel.haria
parent
fc0bc24626
commit
f3bd2931a6
@@ -77,6 +77,7 @@ class BaseImportMatch(models.Model):
|
|||||||
"""
|
"""
|
||||||
# Get usable rules to perform matches
|
# Get usable rules to perform matches
|
||||||
usable = self._usable_rules(model._name, converted_row)
|
usable = self._usable_rules(model._name, converted_row)
|
||||||
|
usable = self.browse(usable)
|
||||||
# Traverse usable combinations
|
# Traverse usable combinations
|
||||||
for combination in usable:
|
for combination in usable:
|
||||||
combination_valid = True
|
combination_valid = True
|
||||||
@@ -126,7 +127,7 @@ class BaseImportMatch(models.Model):
|
|||||||
for record in available:
|
for record in available:
|
||||||
if all(f.name in fields for f in record.field_ids):
|
if all(f.name in fields for f in record.field_ids):
|
||||||
result |= record
|
result |= record
|
||||||
return result
|
return result.ids
|
||||||
|
|
||||||
|
|
||||||
class BaseImportMatchField(models.Model):
|
class BaseImportMatchField(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user