Skip to content
Snippets Groups Projects
Commit 5ccc7dfc authored by Demesmaeker's avatar Demesmaeker
Browse files

[FIX] sale_product_matrix: error in matrix tour


Following the steps that changed every quantity in a matrix, the next
step was triggered after at least one sale order line's quantity was
changed. Due to the number of lines created, one of the so lines was
sometimes not updated before the next step, which produces an error in
the final sale_count.

In order to check the total and ensure every line was updated, we set
the partner sooner in the tour, which in turn sets the pricelist used to
get the price of each line. Thus allowing a check on the subtotal.

Backport of commit-af1e67aa2c6c676479ee4ea73106bcabd20c621e

closes odoo/odoo#100301

X-original-commit: e0461e1d
Signed-off-by: default avatarMorgane Demesmaeker <edm@odoo.com>
parent 3d59cc84
No related branches found
No related tags found
No related merge requests found
......@@ -12,20 +12,20 @@ tour.register('sale_matrix_tour', {
trigger: ".o_list_button_add",
extra_trigger: ".o_sale_order"
}, {
trigger: "a:contains('Add a product')"
trigger: '.o_required_modifier[name=partner_id] input',
run: 'text Agrolait',
}, {
trigger: '.ui-menu-item > a:contains("Agrolait")',
auto: true,
}, {
trigger: 'a:contains("Add a product")',
}, {
trigger: '.o_data_cell',
}, {
trigger: 'div[name="product_template_id"] input',
run: function () {
var $input = $('div[name="product_template_id"] input');
$input.click();
$input.val('Matrix');
var keyDownEvent = jQuery.Event("keydown");
keyDownEvent.which = 42;
$input.trigger(keyDownEvent);
}
run: 'text Matrix',
}, {
trigger: 'ul.ui-autocomplete a:contains("Matrix")',
run: 'click'
}, {
trigger: '.o_product_variant_matrix',
run: function () {
......@@ -34,14 +34,15 @@ tour.register('sale_matrix_tour', {
}
}, {
trigger: 'span:contains("Confirm")',
run: 'click'
}, {
trigger: '.o_sale_order',
// wait for qty to be 1 => check the total to be sure all qties are set to 1
extra_trigger: '.oe_subtotal_footer_separator:contains("18.40")',
}, {
trigger: 'span:contains("Matrix (PAV11, PAV22, PAV31)\n\nPA4: PAV41")',
extra_trigger: '.o_form_editable',
run: 'click'
}, {
trigger: '.o_edit_product_configuration',
run: 'click' // edit the matrix
trigger: '.o_edit_product_configuration', // edit the matrix
}, {
trigger: '.o_product_variant_matrix',
run: function () {
......@@ -49,15 +50,16 @@ tour.register('sale_matrix_tour', {
$('.o_matrix_input').val(3);
}
}, {
trigger: 'span:contains("Confirm")',
run: 'click' // apply the matrix
trigger: 'span:contains("Confirm")', // apply the matrix
}, {
trigger: '.o_sale_order',
// wait for qty to be changed => check the total to be sure all qties are set to 3
extra_trigger: '.oe_subtotal_footer_separator:contains("55.20")',
}, {
trigger: 'span:contains("Matrix (PAV11, PAV22, PAV31)\n\nPA4: PAV41")',
extra_trigger: '.o_form_editable',
run: 'click'
}, {
trigger: '.o_edit_product_configuration',
run: 'click' // edit the matrix
}, {
trigger: '.o_product_variant_matrix',
run: function () {
......@@ -66,30 +68,21 @@ tour.register('sale_matrix_tour', {
}
}, {
trigger: 'span:contains("Confirm")',
run: 'click' // apply the matrix
}, {
trigger: ".o_form_editable .o_field_many2one[name='partner_id'] input",
extra_trigger: ".o_sale_order",
run: 'text Agrolait'
}, {
trigger: ".ui-menu-item > a",
auto: true,
in_modal: false,
trigger: '.o_sale_order',
// wait for qty to be 1 => check the total to be sure all qties are reset to 1
extra_trigger: '.oe_subtotal_footer_separator:contains("18.40")',
}, {
trigger: '.o_form_button_save:contains("Save")',
run: 'click' // SAVE Sales Order.
trigger: '.o_form_button_save:contains("Save")', // SAVE Sales Order.
},
// Open the matrix through the pencil button next to the product in line edit mode.
{
trigger: '.o_form_button_edit:contains("Edit")',
run: 'click' // Edit Sales Order.
trigger: '.o_form_button_edit:contains("Edit")', // Edit Sales Order.
}, {
trigger: 'span:contains("Matrix (PAV11, PAV22, PAV31)\n\nPA4: PAV41")',
extra_trigger: '.o_form_editable',
run: 'click'
}, {
trigger: '.o_edit_product_configuration',
run: 'click' // edit the matrix
trigger: '.o_edit_product_configuration', // edit the matrix
}, {
trigger: '.o_product_variant_matrix',
run: function () {
......@@ -97,32 +90,24 @@ tour.register('sale_matrix_tour', {
$('.o_matrix_input').slice(8, 16).val(4);
} // set the qty to 4 for half of the matrix products.
}, {
trigger: 'span:contains("Confirm")',
run: 'click' // apply the matrix
trigger: 'span:contains("Confirm")', // apply the matrix
}, {
trigger: '.o_sale_order',
// wait for qty to be changed => check the total to be sure all qties are set to either 1 or 4
extra_trigger: '.oe_subtotal_footer_separator:contains("46.00")',
}, {
trigger: '.o_form_button_save:contains("Save")',
extra_trigger: '.o_field_cell.o_data_cell.o_list_number:contains("4.00")',
run: 'click' // SAVE Sales Order, after matrix has been applied (extra_trigger).
}, {
trigger: '.o_form_button_edit:contains("Edit")',
run: 'click' // Edit Sales Order.
trigger: '.o_form_button_edit:contains("Edit")', // Edit Sales Order.
},
// Ensures the matrix is opened with the values, when adding the same product.
{
trigger: "a:contains('Add a product')"
}, {
trigger: 'div[name="product_template_id"] input',
run: function () {
var $input = $('div[name="product_template_id"] input');
$input.click();
$input.val('Matrix');
var keyDownEvent = jQuery.Event("keydown");
keyDownEvent.which = 42;
$input.trigger(keyDownEvent);
}
run: 'text Matrix'
}, {
trigger: 'ul.ui-autocomplete a:contains("Matrix")',
run: 'click'
}, {
trigger: "input[value='4']",
run: function () {
......@@ -131,11 +116,12 @@ tour.register('sale_matrix_tour', {
}
}, {
trigger: 'span:contains("Confirm")',
run: 'click' // apply the matrix
}, {
trigger: '.o_sale_order',
// wait for qty to be changed => check the total to be sure all qties are set
extra_trigger: '.oe_subtotal_footer_separator:contains("65.32")',
}, {
trigger: '.o_form_button_save:contains("Save")',
extra_trigger: '.o_field_cell.o_data_cell.o_list_number:contains("8.20")',
run: 'click' // SAVE Sales Order, after matrix has been applied (extra_trigger).
},
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment