From 80141a144c6d70daf0f02834af7a00541a2c60f8 Mon Sep 17 00:00:00 2001 From: Florent Viard Date: Thu, 27 May 2021 16:52:23 +0200 Subject: [PATCH] [bred] transfer recipients: Switch to the univers associated with an account Listing recipients or the recipient of an account might not be possible when in unrelated univers (spaces). For example, it can't be done when inside the "immobilier" loan space. --- modules/bred/bred/browser.py | 7 ++++++- modules/bred/module.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/bred/bred/browser.py b/modules/bred/bred/browser.py index dbd838db0e..ef65a971c4 100644 --- a/modules/bred/bred/browser.py +++ b/modules/bred/bred/browser.py @@ -523,8 +523,11 @@ def fill_account(self, account, fields): @need_login def iter_transfer_recipients(self, account): - self.update_headers() + if account._univers != self.current_univers: + self.update_headers() + self.move_to_universe(account._univers) + self.update_headers() try: self.emitters_list.go(json={ 'typeVirement': 'C', @@ -676,6 +679,8 @@ def init_new_recipient(self, recipient, **params): @need_login def init_transfer(self, transfer, account, recipient, **params): + self.move_to_universe(account._univers) + account_id = account.id.split('.')[0] poste = account.id.split('.')[1] diff --git a/modules/bred/module.py b/modules/bred/module.py index 663e7d7fb6..afc5bf74e9 100644 --- a/modules/bred/module.py +++ b/modules/bred/module.py @@ -95,6 +95,9 @@ def fill_account(self, account, fields): def iter_transfer_recipients(self, account): if not isinstance(account, Account): account = find_object(self.iter_accounts(), id=account) + elif not hasattr(account, '_univers'): + # We need a Bred filled Account to know the "univers" associated with the account + account = find_object(self.iter_accounts(), id=account.id) return self.browser.iter_transfer_recipients(account) -- GitLab