Commit 99984924 authored by Jerome Berthier's avatar Jerome Berthier Committed by Romain Bignon

[caissedepargne] for netpro, fix duplicated transactions between pro accounts

The website is broken, when there are several accounts the direct link to an account displays
the history of the last visited account (or the first account in the list).

To reach the correct history I use the form sent when selecting an account from the dedicated select box.
parent 2f376937
......@@ -481,6 +481,10 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
self.page.go_history(info)
# ensure we are on the correct history page
if 'netpro' in self.page.url and not self.page.is_history_of(info['id']):
self.page.go_history_netpro(info)
info['link'] = [info['link']]
for i in range(self.HISTORY_MAX_PAGE):
......
......@@ -589,6 +589,12 @@ class IndexPage(LoggedPage, HTMLPage):
form.submit()
def is_history_of(self, account_id):
"""
Check whether the displayed history is for the correct account
"""
return bool(self.doc.xpath('//option[@value="%s" and @selected]' % account_id))
def go_history(self, info, is_cbtab=False):
form = self.get_form(id='main')
......@@ -601,6 +607,20 @@ class IndexPage(LoggedPage, HTMLPage):
fix_form(form)
return form.submit()
def go_history_netpro(self, info, ):
"""
On the netpro website the go_history() does not work.
Even from a web browser the site does not work, and display the history of the first account
We use a different post to go through and display the history we need
"""
form = self.get_form(id='main')
form['m_ScriptManager'] = 'MM$m_UpdatePanel|MM$HISTORIQUE_COMPTE$m_ExDropDownList'
form['MM$HISTORIQUE_COMPTE$m_ExDropDownList'] = info['id']
form['__EVENTTARGET'] = 'MM$HISTORIQUE_COMPTE$m_ExDropDownList'
fix_form(form)
return form.submit()
def get_form_to_detail(self, transaction):
m = re.match('.*\("(.*)", "(DETAIL_OP&[\d]+).*\)\)', transaction._link)
# go to detailcard page
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment