From 218fd1a854088c2d71bb8fa4d5ef2c22eac4fe1e Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Wed, 18 Oct 2023 16:49:08 +0200 Subject: [PATCH] [IMP] pos_self_order: remove resume section for attribute_selection In this commit, we remove the resume section for the attribute_selection as it can lead to a lot of screen for the end-user (especially if the attribute_selection is used in a combo). We add the add to cart button instead with a quantity selector. The end resume is kept for the combo selection. Part-of: odoo/odoo#139187 --- .../attribute_selection.js | 12 +- .../attribute_selection.xml | 105 +++++++----------- .../combo_selection/combo_selection.js | 6 +- .../combo_selection/combo_selection.xml | 2 +- .../app/pages/product_page/product_page.js | 7 +- .../app/pages/product_page/product_page.xml | 1 - 6 files changed, 44 insertions(+), 89 deletions(-) diff --git a/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.js b/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.js index 6c900ec0049..41871d96c9f 100644 --- a/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.js +++ b/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.js @@ -7,7 +7,7 @@ import { attributeFlatter, attributeFormatter } from "@pos_self_order/app/utils" export class AttributeSelection extends Component { static template = "pos_self_order.AttributeSelection"; - static props = ["toggleQtyBtn", "product"]; + static props = ["product"]; setup() { this.selfOrder = useSelfOrder(); @@ -15,17 +15,12 @@ export class AttributeSelection extends Component { this.currentAttribute = 0; this.state = useState({ - showResume: false, showNext: false, showCustomInput: false, }); this.selectedValues = useState(this.env.selectedValues); - if (!this.env.editable) { - this.toggleResume(); - } - this.initAttribute(); } @@ -90,11 +85,6 @@ export class AttributeSelection extends Component { } } - toggleResume() { - this.state.showResume = !this.state.showResume; - this.props.toggleQtyBtn(this.state.showResume); - } - isChecked(attribute, value) { return attribute.display_type === "multi" ? this.selectedValues[attribute.id][value.id] diff --git a/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.xml b/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.xml index 258d7f50d21..7fa234403ac 100644 --- a/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.xml +++ b/addons/pos_self_order/static/src/app/components/attribute_selection/attribute_selection.xml @@ -2,76 +2,49 @@
- -
-

Your resume

-
-
    -
  • -
    - : -
    - -
  • -
-
- -
-
-
-

-
- -
-
- - - -
+
+
+
+

+
+ +
+
+ + +
-
- -
- -
+
+
+ +
+

- -
- -
-
- - -
- -
-
+
diff --git a/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.js b/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.js index 51d445b3bf5..35a06ac7b37 100644 --- a/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.js +++ b/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.js @@ -22,10 +22,8 @@ export class ComboSelection extends Component { this.props.comboState.selectedProduct = productSelected; if (productSelected.attributes.length === 0) { this.props.next(); + return; } - } - - toggleQtyBtn(bool) { - this.props.comboState.showQtyButtons = bool; + this.props.comboState.showQtyButtons = true; } } diff --git a/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.xml b/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.xml index b958d304958..3bb6dbd200d 100644 --- a/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.xml +++ b/addons/pos_self_order/static/src/app/components/combo_selection/combo_selection.xml @@ -51,7 +51,7 @@

- + diff --git a/addons/pos_self_order/static/src/app/pages/product_page/product_page.js b/addons/pos_self_order/static/src/app/pages/product_page/product_page.js index 6de298e9fc4..ffb8545539d 100644 --- a/addons/pos_self_order/static/src/app/pages/product_page/product_page.js +++ b/addons/pos_self_order/static/src/app/pages/product_page/product_page.js @@ -27,7 +27,6 @@ export class ProductPage extends Component { this.state = useState({ qty: 1, customer_note: "", - showQtyButtons: this.attributes.length === 0, product: this.props.product, }); @@ -55,10 +54,6 @@ export class ProductPage extends Component { ); } - toggleQtyBtn(bool) { - this.state.showQtyButtons = bool; - } - initState() { const editedLine = this.selfOrder.editedLine; @@ -151,6 +146,6 @@ export class ProductPage extends Component { } get showQtyButtons() { - return this.state.showQtyButtons && this.props.product.self_order_available; + return this.props.product.self_order_available; } } diff --git a/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml b/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml index be8b2fcd87c..fb6e5fa80e1 100644 --- a/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml +++ b/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml @@ -34,7 +34,6 @@