* crm, project, website, website_event, website_blog, website_forum, website_sale Eg: the tour 'shop_buy_product' is extended by the website_sale_options addons to add a step to close a modal. The current solution was requiring the module that defines the tour to extend, then add/remove steps in the "step" key of the tour definition. Some of the problems with this method were: * The "register" method calls the "update" method to immediately search for tip to place once registered (as register may be called after the DOM is ready). So extensions of tours were happening after the tours were started (and the tours were not restarted). * The addition/removal of steps was happening after they were filtered according to the "edition" key. To allow extension, the system is changed as follow: * The "register" method now only saves the steps and options without modifying them and does not call the "update" method. * Once the DOM was ready, the tour service started listening to DOM mutations and called the "update" tour method. Now, this "update" call is replaced by a "_register_all" call, on DOM ready and at the end of the current call stack (which makes sure all modules are loaded). This "_register_all" method marks the registered tours as ready after having filtered the steps according to the "edition" key and initialized the current step to trigger. * Also, tours can now define a "wait_for" option which allow them to be marked as ready for run and update after the given deferred. Those tours can now also be extended without having to wait for the deferred. PhamtomJS must wait for the "ready" key to be true to run the tour.
9 lines
319 B
Python
9 lines
319 B
Python
import odoo.tests
|
|
|
|
|
|
@odoo.tests.common.at_install(False)
|
|
@odoo.tests.common.post_install(True)
|
|
class TestUi(odoo.tests.HttpCase):
|
|
def test_admin(self):
|
|
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('event')", "odoo.__DEBUG__.services['web_tour.tour'].tours.event.ready", login='admin')
|