From 033608eb11cff4b983038388e9cba5dd3e02ffac Mon Sep 17 00:00:00 2001 From: "Julien (juc) Castiaux" Date: Thu, 20 Dec 2018 08:47:13 +0000 Subject: [PATCH] [FIX] sale: non-consistent tests The tests of the sale module are not constistent. Success depends on version in use (com vs ent) and the modules installed (sale, stock, event_sale). **Fix 1** The "Description" field is updated by a onchange while saving the record. **Fix 2** The `sale_stock` module adds a new step to click "ok" on the warning modal shown when saling a product without enough of that product on hand. The added step was added to test_01 (that doesn't show the modal) instead of test_02. **Fix 3** There is a difference between the price of the SO between community and enterprise. **Fix 4** The event_sale module changes the form view thus need to perform more steps to create a record. opw-1912266 closes odoo/odoo#29679 --- addons/event_sale/__manifest__.py | 1 + addons/event_sale/static/src/js/tour.js | 13 +++++++++++++ .../event_sale/views/event_views_template.xml | 8 ++++++++ addons/sale/static/src/js/tour.js | 2 +- .../tests/product_configurator_test_ui.js | 1 + addons/sale_stock/static/src/js/tour.js | 17 +++++++++++++---- 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 addons/event_sale/static/src/js/tour.js create mode 100644 addons/event_sale/views/event_views_template.xml diff --git a/addons/event_sale/__manifest__.py b/addons/event_sale/__manifest__.py index 2293b52dfb5..839ef948898 100644 --- a/addons/event_sale/__manifest__.py +++ b/addons/event_sale/__manifest__.py @@ -21,6 +21,7 @@ this event. 'depends': ['event', 'sale_management'], 'data': [ 'views/event_views.xml', + 'views/event_views_template.xml', 'views/product_views.xml', 'views/sale_order_views.xml', 'data/event_sale_data.xml', diff --git a/addons/event_sale/static/src/js/tour.js b/addons/event_sale/static/src/js/tour.js new file mode 100644 index 00000000000..148e1e14032 --- /dev/null +++ b/addons/event_sale/static/src/js/tour.js @@ -0,0 +1,13 @@ +odoo.define("event_sale.tour", function (require) { + "use strict"; + + var tour = require('web_tour.tour'); + require('sale.tour'); + + var step_index = _.findIndex(tour.tours.sale_tour.steps, function (step) { + return (step.id === "form_button_save_clicked"); + }); + tour.tours.sale_tour.steps.splice(step_index, 0, { + trigger: ".modal-dialog .modal-footer .btn-primary:contains('Save & Close')", + }); +}); diff --git a/addons/event_sale/views/event_views_template.xml b/addons/event_sale/views/event_views_template.xml new file mode 100644 index 00000000000..ae3ffef9752 --- /dev/null +++ b/addons/event_sale/views/event_views_template.xml @@ -0,0 +1,8 @@ + + + + diff --git a/addons/sale/static/src/js/tour.js b/addons/sale/static/src/js/tour.js index fe4eac6fbbc..3af1f0364af 100644 --- a/addons/sale/static/src/js/tour.js +++ b/addons/sale/static/src/js/tour.js @@ -58,12 +58,12 @@ tour.register('sale_tour', { $('.modal-dialog:has(div.o_dialog_warning) footer.modal-footer .btn-primary').trigger('click'); } }, - id: "quotation_product_selected", }, { trigger: ".o_form_button_save", extra_trigger: ".o_sale_order", content: _t("Once your quotation is ready, you can save, print or send it by email."), position: "right", + id: "form_button_save_clicked" }, { trigger: ".o_sale_print", extra_trigger: ".o_sale_order.o_form_readonly", diff --git a/addons/sale_management/static/tests/product_configurator_test_ui.js b/addons/sale_management/static/tests/product_configurator_test_ui.js index 57bb3340394..03f5a0a8bbc 100644 --- a/addons/sale_management/static/tests/product_configurator_test_ui.js +++ b/addons/sale_management/static/tests/product_configurator_test_ui.js @@ -70,6 +70,7 @@ tour.register('sale_product_configurator_tour', { }, { trigger: 'button span:contains(Confirm)', extra_trigger: '.oe_optional_products_modal', + id: "quotation_product_selected", run: 'click' }, // check that 3 products were added to the SO diff --git a/addons/sale_stock/static/src/js/tour.js b/addons/sale_stock/static/src/js/tour.js index 2cc85671aef..d27080305d5 100644 --- a/addons/sale_stock/static/src/js/tour.js +++ b/addons/sale_stock/static/src/js/tour.js @@ -4,17 +4,26 @@ odoo.define("sale_stock.tour", function (require) { var tour = require('web_tour.tour'); require('sale.tour'); - var quotation_product_selected_step_index = _.findIndex(tour.tours.sale_tour.steps, function (step) { + var quotation_product_selected_step_index = _.findIndex(tour.tours.sale_product_configurator_tour.steps, function (step) { return (step.id === "quotation_product_selected"); }); - tour.tours.sale_tour.steps[quotation_product_selected_step_index].run = function (actions) { + tour.tours.sale_product_configurator_tour.steps[quotation_product_selected_step_index].run = function (actions) { actions.auto(); }; - tour.tours.sale_tour.steps.splice(quotation_product_selected_step_index+1, 0, { - trigger: ".modal-footer .btn-primary", + tour.tours.sale_product_configurator_tour.steps.splice(quotation_product_selected_step_index+1, 0, { + trigger: ".o_dialog_warning + .modal-footer .btn-primary", auto: true, + run: function (actions) { + actions.auto('.o_dialog_warning + .modal-footer .btn-primary'); + } + }, { + trigger: ".o_dialog_warning + .modal-footer .btn-primary", + auto: true, + run: function (actions) { + actions.auto('.o_dialog_warning + .modal-footer .btn-primary'); + } }, { trigger: "body:not(:has(.o_dialog_warning))", auto: true,