From f7ead5fd50f4b6db2a1d4c947fc4e15dceedbbd7 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 23 Aug 2018 16:10:48 +0200 Subject: [PATCH] [FIX] account: reconciliation tour, set the url to use in python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Continuation and ending of 1f848bf. Before this commit, the bank statement reconciliation still sometimes crashed. Each step of the tour waits 10 secs before timeout and in this case, changing URL may take more time since this commit b0a29c9b because we added 'debug=assets'. It was probably a mistake. So, removing this from the URL would probably solve the error but the second step would always be dependent on the first. It's why we decided to load the tour with the correct URL defined in Python. Co-authored-by: Adrien Dieudonné --- .../js/reconciliation/tour_reconciliation.js | 19 ------------------- .../tests/test_reconciliation_widget.py | 9 ++++++++- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/addons/account/static/src/js/reconciliation/tour_reconciliation.js b/addons/account/static/src/js/reconciliation/tour_reconciliation.js index c4ea807bab2..ab6efaef113 100644 --- a/addons/account/static/src/js/reconciliation/tour_reconciliation.js +++ b/addons/account/static/src/js/reconciliation/tour_reconciliation.js @@ -9,25 +9,6 @@ Tour.register('bank_statement_reconciliation', { test: true, // Go to the reconciliation page of the statement: "BNK/2014/001" }, [ - { - content: "wait web client", - extra_trigger: 'body:not(:has(.o_reconciliation))', - trigger: '.o_web_client', - run: function () { - console.log("looking for 'bank_statement_reconciliation' url"); - rpc.query({ - model: 'account.bank.statement', - method: 'search', - args: [[['name', '=', 'BNK/2014/001']]], // account in l10n_generic_coa - }).then(function(ids) { - var path = "/web?debug=assets#statement_ids=" + ids[0] + "&action=bank_statement_reconciliation_view"; - console.log("'bank_statement_reconciliation' url is: '" + path + "'"); - window.location.href = path; - }).fail(function () { - throw new Error("'account.bank.statement' named 'BNK/2014/001' not found"); - }); - }, - }, // Reconciliation of 'SAJ/2018/002' // Select the 'INV/2018/0002' line and click on reconcile. diff --git a/addons/account/tests/test_reconciliation_widget.py b/addons/account/tests/test_reconciliation_widget.py index 9ca8e36c4df..f564b59380d 100644 --- a/addons/account/tests/test_reconciliation_widget.py +++ b/addons/account/tests/test_reconciliation_widget.py @@ -1,5 +1,8 @@ +import logging import odoo.tests +_logger = logging.getLogger(__name__) + @odoo.tests.tagged('post_install', '-at_install') @odoo.tests.common.at_install(False) @@ -7,6 +10,10 @@ import odoo.tests class TestUi(odoo.tests.HttpCase): def test_01_admin_bank_statement_reconciliation(self): - self.phantom_js("/web", + bank_stmt = self.env['account.bank.statement'].search([('name', '=', 'BNK/2014/001')]) + if not bank_stmt: + _logger.exception('Could not find bank statement BNK/2014/001') + + self.phantom_js("/web#statement_ids=" + str(bank_stmt.id) + "&action=bank_statement_reconciliation_view", "odoo.__DEBUG__.services['web_tour.tour'].run('bank_statement_reconciliation')", "odoo.__DEBUG__.services['web_tour.tour'].tours.bank_statement_reconciliation.ready", login="admin")