fix sort of transactions
It now sorts transactions on each page instead of doing it globally
This commit is contained in:
parent
18c1f46922
commit
d1a1938780
2 changed files with 14 additions and 5 deletions
|
|
@ -62,5 +62,4 @@ class OneyBrowser(LoginBrowser):
|
|||
post = {'task': 'Synthese', 'process': 'SyntheseCompte', 'taskid':'Releve'}
|
||||
self.operations.go(data=post)
|
||||
|
||||
return sorted(self.page.iter_transactions(), key=lambda tr: tr.rdate, reverse=True)
|
||||
|
||||
return self.page.iter_transactions(seen=set())
|
||||
|
|
|
|||
|
|
@ -120,7 +120,19 @@ class OperationsPage(LoggedPage, HTMLPage):
|
|||
@pagination
|
||||
@method
|
||||
class iter_transactions(ListElement):
|
||||
item_xpath = '//div[@id = "releve-reserve-credit"]//table/tbody/tr'
|
||||
item_xpath = '//table[@class="tableau-releve"]/tbody/tr[not(node()//span[@class="solde-initial"])]'
|
||||
flush_at_end = True
|
||||
|
||||
def flush(self):
|
||||
# As transactions are unordered on the page, we flush only at end
|
||||
# the sorted list of them.
|
||||
return sorted(self.objects.itervalues(), key=lambda tr: tr.rdate, reverse=True)
|
||||
|
||||
def store(self, obj):
|
||||
# It stores only objects with an ID. To be sure it works, use the
|
||||
# uid of transaction as object ID.
|
||||
obj.id = obj.unique_id(seen=self.env['seen'])
|
||||
return ListElement.store(self, obj)
|
||||
|
||||
class credit(ItemElement):
|
||||
klass = Transaction
|
||||
|
|
@ -150,5 +162,3 @@ class OperationsPage(LoggedPage, HTMLPage):
|
|||
if options:
|
||||
data = {'numReleve':options[0].values(),'task':'Releve','process':'Releve','eventid':'select','taskid':'','hrefid':'','hrefext':''}
|
||||
return requests.Request("POST", self.page.url, data=data)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue