summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Demaret Rivarola <jde@odoo.com>2019-05-08 08:41:42 +0000
committerJohan Demaret Rivarola <jde@odoo.com>2019-05-09 15:47:20 +0000
commite11bacfe512a3170f44d6d43646af914a9cf3b73 (patch)
treeb27f744578f823fbeb4568001686401b2668cc11
parentde3a4c29476a34eb5db0c736124404113c03fd1a (diff)
[FIX] sale_stock: tour dependency on sale_management
Creating a new database with only sale_stock installed will lead the boot_tests.js test to fail. That's because commit 033608eb11cff4b983038388e9cba5dd3e02ffac introduces an implicit dependency on a sale_management tour. This seems to be a mistake since sale_stock does not depend on sale_management. The tour only makes sense if both sale_stock and sale_management are installed though. That's why the additional steps will be run conditionally. After this commit, the extra steps will only be run when sale_management is installed. Technically, this is done by checking whether odoo._modules contains sale_management. opw-1964469 closes #33275 Signed-off-by: Christophe Simonis <chs@odoo.com>
-rw-r--r--addons/sale_stock/static/src/js/tour.js68
1 files changed, 38 insertions, 30 deletions
diff --git a/addons/sale_stock/static/src/js/tour.js b/addons/sale_stock/static/src/js/tour.js
index d27080305d5..cc64f95fecd 100644
--- a/addons/sale_stock/static/src/js/tour.js
+++ b/addons/sale_stock/static/src/js/tour.js
@@ -1,43 +1,51 @@
-odoo.define("sale_stock.tour", function (require) {
+var deps = ['web_tour.tour'];
+
+if (_.contains(odoo._modules, 'sale_management')) {
+ deps.push('sale.product_configurator_tour');
+ deps.push('sale.product_configurator_pricelist_tour');
+}
+
+odoo.define("sale_stock.tour", deps, function (require) {
"use strict";
var tour = require('web_tour.tour');
- require('sale.tour');
- var quotation_product_selected_step_index = _.findIndex(tour.tours.sale_product_configurator_tour.steps, function (step) {
- return (step.id === "quotation_product_selected");
- });
+ if (_.has(odoo.__DEBUG__.services, 'sale.product_configurator_tour')) {
+ 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_product_configurator_tour.steps[quotation_product_selected_step_index].run = function (actions) {
- actions.auto();
- };
+ tour.tours.sale_product_configurator_tour.steps[quotation_product_selected_step_index].run = function (actions) {
+ actions.auto();
+ };
- 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,
- in_modal: false,
- run: function (actions) {
- if ($('.modal-footer .btn-primary').length){
- actions.auto('.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,
+ in_modal: false,
+ run: function (actions) {
+ if ($('.modal-footer .btn-primary').length){
+ actions.auto('.modal-footer .btn-primary');
+ }
+ },
+ });
+ }
// Check if sale_management is installed since sale_stock is adding an extra
// step to add to SO (not enough inventory)
- if ('sale.product_configurator_pricelist_tour' in odoo.__DEBUG__.services) {
+ if (_.has(odoo.__DEBUG__.services, 'sale.product_configurator_pricelist_tour')) {
var steps = tour.tours.sale_product_configurator_pricelist_tour.steps;
for (var k=0; k<steps.length; k++) {
if (steps[k].content === "add to SO") {