[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
This commit is contained in:
Julien (juc) Castiaux
2019-01-04 10:10:43 +00:00
committed by Nans Lefebvre
parent 6da2e23e65
commit 033608eb11
6 changed files with 37 additions and 5 deletions
+1
View File
@@ -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',
+13
View File
@@ -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')",
});
});
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend_inherit_event_sale" inherit_id="web.assets_backend" name="Event sale backend assets">
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/event_sale/static/src/js/tour.js"></script>
</xpath>
</template>
</odoo>
+1 -1
View File
@@ -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",
@@ -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
+13 -4
View File
@@ -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,