fix get of transactions when they are ordered by type
This commit is contained in:
parent
3f5f2b2479
commit
7998230dff
1 changed files with 18 additions and 3 deletions
|
|
@ -50,7 +50,8 @@ class ProAccountsList(Page):
|
||||||
try:
|
try:
|
||||||
account.coming = Decimal(self.parser.tocleanstring(cols[self.COL_COMING]))
|
account.coming = Decimal(self.parser.tocleanstring(cols[self.COL_COMING]))
|
||||||
except InvalidOperation:
|
except InvalidOperation:
|
||||||
self.logger.warning('Unable to parse coming value', exc_info=True)
|
if self.parser.tocleanstring(cols[self.COL_COMING]) != '-':
|
||||||
|
self.logger.warning('Unable to parse coming value', exc_info=True)
|
||||||
account.coming = NotAvailable
|
account.coming = NotAvailable
|
||||||
account._link_id = None
|
account._link_id = None
|
||||||
account._stp = None
|
account._stp = None
|
||||||
|
|
@ -83,12 +84,26 @@ class ProAccountHistory(Page):
|
||||||
COL_DEBIT = -2
|
COL_DEBIT = -2
|
||||||
COL_CREDIT = -1
|
COL_CREDIT = -1
|
||||||
|
|
||||||
|
def on_loaded(self):
|
||||||
|
# If transactions are ordered by type, force order by date.
|
||||||
|
try:
|
||||||
|
checkbox = self.document.xpath('//input[@name="szTriDate"]')[0]
|
||||||
|
except IndexError:
|
||||||
|
return
|
||||||
|
|
||||||
|
if not 'checked' in checkbox.attrib:
|
||||||
|
self.browser.select_form(name='formtri')
|
||||||
|
self.browser['szTriDate'] = ['date']
|
||||||
|
self.browser['szTriRub'] = []
|
||||||
|
self.browser.submit()
|
||||||
|
|
||||||
def iter_operations(self):
|
def iter_operations(self):
|
||||||
for i, tr in enumerate(self.document.xpath('//tr[@class="hdoc1" or @class="hdotc1"]')):
|
for i, tr in enumerate(self.document.xpath('//tr[@class="hdoc1" or @class="hdotc1"]')):
|
||||||
if 'bgcolor' not in tr.attrib:
|
|
||||||
continue
|
|
||||||
cols = tr.findall('td')
|
cols = tr.findall('td')
|
||||||
|
|
||||||
|
if len(cols) < 4:
|
||||||
|
continue
|
||||||
|
|
||||||
op = Transaction(i)
|
op = Transaction(i)
|
||||||
|
|
||||||
date = self.parser.tocleanstring(cols[self.COL_DATE])
|
date = self.parser.tocleanstring(cols[self.COL_DATE])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue