mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Add length check + retrieve first element from search result
This commit is contained in:
@@ -167,10 +167,14 @@ class AccountEasyReconcile(orm.Model):
|
||||
# and return the wrong result.
|
||||
history_obj = self.pool['easy.reconcile.history']
|
||||
for reconcile_id in ids:
|
||||
result[reconcile_id] = history_obj.search(
|
||||
last_history = history_obj.search(
|
||||
cr, uid, [('easy_reconcile_id', '=', reconcile_id)],
|
||||
limit=1, order='date desc'
|
||||
)
|
||||
if len(last_history) > 0:
|
||||
result[reconcile_id] = last_history[0]
|
||||
else:
|
||||
result[reconcile_id] = False
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
|
||||
Reference in New Issue
Block a user