mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Modify _last_history function to correctly retrieve the date
This commit is contained in:
@@ -162,11 +162,16 @@ class AccountEasyReconcile(orm.Model):
|
||||
|
||||
def _last_history(self, cr, uid, ids, name, args, context=None):
|
||||
result = {}
|
||||
for history in self.browse(cr, uid, ids, context=context):
|
||||
result[history.id] = False
|
||||
if history.history_ids:
|
||||
# history is sorted by date desc
|
||||
result[history.id] = history.history_ids[0].id
|
||||
# do a search() for retrieving the latest history line,
|
||||
# as a read() will badly split the list of ids with 'date desc'
|
||||
# and return the wrong result.
|
||||
for reconcile_id in ids:
|
||||
history_obj = self.pool['easy.reconcile.history']
|
||||
last_history = history_obj.search(
|
||||
cr, uid, [('easy_reconcile_id', '=', reconcile_id)],
|
||||
limit=1, order='date desc'
|
||||
)
|
||||
result[reconcile_id] = last_history
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
|
||||
Reference in New Issue
Block a user