[FIX] account: reconciliation tour, set the url to use in python

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é <adr@odoo.com>
This commit is contained in:
Cedric Snauwaert
2018-08-24 13:03:30 +02:00
committed by Adrien Dieudonne
co-authored by Adrien Dieudonné
parent 265263dbce
commit f7ead5fd50
2 changed files with 8 additions and 20 deletions
@@ -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.
@@ -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")