[FIX] Module 'auditlog' - Support 'read' calls with one ID or a list of IDs
parent
fba30d2c78
commit
8ca62fd59d
|
@ -219,9 +219,11 @@ class auditlog_rule(models.Model):
|
||||||
def read(self, *args, **kwargs):
|
def read(self, *args, **kwargs):
|
||||||
result = read.origin(self, *args, **kwargs)
|
result = read.origin(self, *args, **kwargs)
|
||||||
# Sometimes the result is not a list but a dictionary
|
# Sometimes the result is not a list but a dictionary
|
||||||
if not isinstance(result, list):
|
# Also, we can not modify the current result as it will break calls
|
||||||
result = [result]
|
result2 = result
|
||||||
read_values = dict((d['id'], d) for d in result)
|
if not isinstance(result2, list):
|
||||||
|
result2 = [result]
|
||||||
|
read_values = dict((d['id'], d) for d in result2)
|
||||||
# Old API
|
# Old API
|
||||||
if args and isinstance(args[0], sql_db.Cursor):
|
if args and isinstance(args[0], sql_db.Cursor):
|
||||||
cr, uid, ids = args[0], args[1], args[2]
|
cr, uid, ids = args[0], args[1], args[2]
|
||||||
|
|
Loading…
Reference in New Issue