From f29df7fb2eed9bee7fa1f3452e1efa26f2dd4fb1 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 29 Aug 2018 13:48:25 +0200 Subject: [PATCH] [FIX] web: Fixed the printing of reports. A new exception has been added to detect inconsistent reports. However, many are not structured as expected. Thus, the change consists mainly of checking only when the print has to be separated in part to attach it to the respective documents. We now take the page tag instead of the article, because the article tag is in the layout, so to separate the file, the t-call had to be inside the t-foreach (for the separation) and so possibly read the assets several times. Since all templates have the first tag (in the t-foreach) tag page, the choice is more sensible. The javascripts files used in readonly were taken out of the editing assets. A turn was made but not activated, it works locally, but on the runbot, an error is triggered when generating assets after choosing the settings. --- addons/account/views/report_invoice.xml | 2 +- addons/stock/static/tests/route_tour.js | 56 +++++++++++++++++++ addons/stock/tests/__init__.py | 3 + addons/stock/tests/test_ui.py | 10 ++++ addons/stock/views/stock_template.xml | 1 + .../web/static/src/js/report/report.editor.js | 24 -------- addons/web/static/src/js/report/report.js | 40 +++++++++++++ addons/web/views/report_templates.xml | 26 +++++---- odoo/addons/base/models/ir_actions_report.py | 26 ++++++--- 9 files changed, 142 insertions(+), 46 deletions(-) create mode 100644 addons/stock/static/tests/route_tour.js create mode 100644 addons/stock/tests/test_ui.py create mode 100644 addons/web/static/src/js/report/report.js diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index b43f48eab9e..18fac77f256 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -8,7 +8,7 @@
:
-
+

Invoice Draft Invoice diff --git a/addons/stock/static/tests/route_tour.js b/addons/stock/static/tests/route_tour.js new file mode 100644 index 00000000000..e75695a5f69 --- /dev/null +++ b/addons/stock/static/tests/route_tour.js @@ -0,0 +1,56 @@ +odoo.define('stock.tour', function (require) { +'use strict'; + +var tour = require('web_tour.tour'); + +tour.register('stock', { + test: true, + url: '/web?debug=assets#action=stock.action_stock_config_settings', + }, + [ + { + content: "wait web client", + trigger: ".o_base_settings", + run: function() {} + }, + { + content: "active 'Multi-Step Routes'", + trigger: '.o_field_boolean[name="group_stock_adv_location"]', + run: function() { + if (!this.$anchor.find('input').prop('checked')) { + this.$anchor.find('label').click(); + $('.o_statusbar_buttons button[name="execute"]').click(); + } + } + }, + { + content: "list of product variants", + trigger: '.o_sub_menu .oe_secondary_submenu [data-menu-xmlid="stock.menu_product_variant_config_stock"]', + extra_trigger: '.o_sub_menu .oe_secondary_submenu:has(a[data-menu-xmlid="stock.menu_routes_config"])', + timeout: 5000, + }, + { + content: "select a product variant", + trigger: '.oe_kanban_global_click:first', + }, + { + content: "click on routes", + trigger: 'button.oe_stat_button i.fa-cogs', + }, + { + content: "print the report", + trigger: 'button[name="print_report"]', + }, + { + content: "print inside the report and check the breadcrum", + trigger: '.o_content iframe .o_report_stock_rule_rule_name', + extra_trigger: 'ol.breadcrumb li:eq(2).active', + }, + { + content: "print the report", + trigger: 'ol.breadcrumb li:eq(3).active', + }, + ] +); + +}); diff --git a/addons/stock/tests/__init__.py b/addons/stock/tests/__init__.py index 25ae6888c7c..50780301d3d 100644 --- a/addons/stock/tests/__init__.py +++ b/addons/stock/tests/__init__.py @@ -14,3 +14,6 @@ from . import test_packing from . import test_packing_neg from . import test_proc_rule from . import test_wise_operator + +# TODO enable this test: error on runbot to create asset and open the iframe +# from . import test_ui diff --git a/addons/stock/tests/test_ui.py b/addons/stock/tests/test_ui.py new file mode 100644 index 00000000000..ef434ea678a --- /dev/null +++ b/addons/stock/tests/test_ui.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import odoo.tests + +@odoo.tests.tagged('post_install', '-at_install') +class TestUi(odoo.tests.HttpCase): + + def test_01_admin_stock_route(self): + self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('stock')", "odoo.__DEBUG__.services['web_tour.tour'].tours.stock.ready", login='admin') diff --git a/addons/stock/views/stock_template.xml b/addons/stock/views/stock_template.xml index fa3ae244ee2..3ca9f6783b2 100644 --- a/addons/stock/views/stock_template.xml +++ b/addons/stock/views/stock_template.xml @@ -3,6 +3,7 @@