diff options
| author | Aurélien Warnon <awa@odoo.com> | 2019-03-06 07:24:28 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2019-03-28 14:55:00 +0000 |
| commit | 220f5ae53f66400320b697c778039b0585da8fc4 (patch) | |
| tree | c043173861eeb83ee54688a20ef983bd3c39744c /odoo/addons/test_main_flows | |
| parent | 55ed70f405a7614756f878599ddc7e7d34f6b508 (diff) | |
[IMP] sale_product_configurator: improve p. configurator
Task #1891970
Original p. configurator commit d3530eb
Purpose
=======
- The p. configurator now comes with a widget that is "o2m" like in the SO lines view.
The widget is only used on the added "product_template_id" field on the SO line.
This widget controls the opening of the configuration window and removes the need of a "Configure a product" button.
The "SectionAndNoteListRenderer" is now cleaned from p. configurator specific code.
The widget is also responsible for handling the configuration provided by the p. configurator form
and applying it on the SO line with a 'field_changed' event that updates all the necessary fields.
- Added support for 'MULTI' and 'DELETE_ALL' operations on X2Many fields in basic_model.js
- 'MULTI' allows to batch multiple operations at once
- 'DELETE_ALL' behaves like 'DELETE' with all the current data of the field
Spec
=======
- remove "configure a product" from sale order lines
When the product configurator is active, replace the product_product_id by a product_template_id
in the sale order line. When we select a template without variants, it sets the variant automatically,
but when we select a product template having variants, it opens the configurator dialog.
- add a widget to modify the product configuration in the sale order line (next to product template field)
- UX improvements:
- Invert image and configuration in the main screen
- If the product doesn't have an image, hide it instead of showing the placeholder (only for first screen?)
- new independent option in sales settings to activate product configurator.
(same in e-commerce)
- demo data: Change demo data to set Customizable Desk & Conference Chair as make to order
- If only one attribute value that is Custom, don't display radio, selection or even color box
Diffstat (limited to 'odoo/addons/test_main_flows')
| -rw-r--r-- | odoo/addons/test_main_flows/static/src/js/tour.js | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/odoo/addons/test_main_flows/static/src/js/tour.js b/odoo/addons/test_main_flows/static/src/js/tour.js index d3608018cf8..4b08c5b1b22 100644 --- a/odoo/addons/test_main_flows/static/src/js/tour.js +++ b/odoo/addons/test_main_flows/static/src/js/tour.js @@ -325,45 +325,70 @@ tour.register('main_flow_tour', { content: _t("Click here to add some lines to your quotations."), position: "bottom", }, { - trigger: ".o_field_widget[name=product_id] input", + /** + * We need both triggers because the "sale_product_configurator" module replaces the + * "product_id" field with a "product_template_id" field. + * This selector will still only ever select one element. + */ + trigger: ".o_field_widget[name=product_id] input, .o_field_widget[name=product_template_id] input", content: _t("Select a product, or create a new one on the fly. The product will define the default sales price (that you can change), taxes and description automatically."), position: "right", - run: "text the_flow.product", -}, { - trigger: ".ui-menu-item > a:contains('the_flow.product')", - auto: true, - in_modal: false, run: function (actions) { - actions.auto(); - // if the one2many isn't editable, we have to close the dialog - if ($(".modal-footer .btn-primary").length) { - actions.auto(".modal-footer .btn-primary"); - } + actions.text("the_flow.product", this.$anchor); + // fake keydown to trigger search + var keyDownEvent = jQuery.Event("keydown"); + keyDownEvent.which = 42; + this.$anchor.trigger(keyDownEvent); + var $descriptionElement = $('.o_form_editable textarea[name="name"]'); + // when description changes, we know the product has been loaded + $descriptionElement.change(function () { + if ($(this).val().indexOf('the_flow.product') !== -1){ + $(this).addClass('product_loading_success'); + } + }); }, }, { + trigger: ".ui-menu-item > a:contains('the_flow.product')", +}, { + trigger: '.o_form_editable textarea[name="name"].product_loading_success', + run: function () {} // wait for product loading +}, { trigger: ".o_field_widget[name=order_line] .o_field_x2many_list_row_add > a", content: _t("Click here to add some lines to your quotations."), position: "bottom", }, { - trigger: ".o_field_widget[name=product_id] input", - // the one2many may be editable or not according to the modules installed, so - // we have to handle both cases - extra_trigger: '.o_field_widget[name=order_line] .o_data_row:nth(1).o_selected_row, .modal-dialog', + /** + * We need both triggers because the "sale_product_configurator" module replaces the + * "product_id" field with a "product_template_id" field. + * This selector will still only ever select one element. + */ + trigger: ".o_field_widget[name=product_id] input, .o_field_widget[name=product_template_id] input", + extra_trigger: '.o_field_widget[name=order_line] .o_data_row:nth(1).o_selected_row', content: _t("Select a product"), position: "right", - run: "text the_flow.service", -}, { - trigger: ".ui-menu-item > a:contains('the_flow.service')", - auto: true, - in_modal: false, run: function (actions) { - actions.auto(); - // if the one2many isn't editable, we have to close the dialog - if ($(".modal-footer .btn-primary").length) { - actions.auto(".modal-footer .btn-primary"); - } + actions.text("the_flow.service", this.$anchor); + // fake keydown to trigger search + var keyDownEvent = jQuery.Event("keydown"); + keyDownEvent.which = 42; + this.$anchor.trigger(keyDownEvent); + var $descriptionElement = $('.o_form_editable textarea[name="name"]'); + // when description changes, we know the product has been loaded + $descriptionElement.change(function () { + if ($(this).val().indexOf('the_flow.service') !== -1){ + $(this).addClass('product_service_loading_success'); + } + }); }, }, { + trigger: ".ui-menu-item > a:contains('the_flow.service')", +}, { + trigger: '.o_form_editable textarea[name="name"].product_service_loading_success', + run: function () {} // wait for product loading +}, { + trigger: 'label:contains("Untaxed Amount")', + // click somewhere else to exit cell focus +}, { trigger: ".o_statusbar_buttons > button.o_sale_print:enabled", content: _t("<p><b>Print this quotation.</b></p>"), position: "bottom" |
