From a253eb65fba02796686d7d3c1de4ab56b87f7fbd Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Tue, 28 Feb 2023 15:29:41 +0000 Subject: [PATCH] [IMP] pos_sale: Possibility to apply fixed amount on downpayment Until now, it was not possible to apply fixed amount on downpayment. Users were forced to compute the percentage to apply on a downpayment on the side when the wanted to apply a fixed downpayment. This is no more the case. This commit also changes a bit the NumberPopup in the PoS. The NumberPopup can now have a subtitle, a suffix to its input (usefull for symbols like currency or percentage) and in the case of a percentage, can have an indication under the confirm button about how much the percentage means in other unit (like a percentage of a price). The commit also removes the previous downpayment lines on the new order line in the ProductScreen as they were not showing useful information. closes odoo/odoo#118594 Task-id: 2836904 Signed-off-by: Joseph Caburnay (jcb) --- .../static/src/js/Popups/NumberPopup.js | 3 + .../js/Screens/PaymentScreen/PaymentScreen.js | 1 + addons/point_of_sale/static/src/scss/pos.scss | 54 +++++++++++++--- .../static/src/xml/Popups/NumberPopup.xml | 17 +++-- .../SaleOrderManagementScreen.js | 63 ++++++++++++++++--- 5 files changed, 118 insertions(+), 20 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Popups/NumberPopup.js b/addons/point_of_sale/static/src/js/Popups/NumberPopup.js index f8f9900f5d2..3a43abac25b 100644 --- a/addons/point_of_sale/static/src/js/Popups/NumberPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/NumberPopup.js @@ -11,10 +11,13 @@ export class NumberPopup extends AbstractAwaitablePopup { confirmText: _t("Confirm"), cancelText: _t("Discard"), title: _t("Confirm?"), + subtitle: "", body: "", cheap: false, startingValue: null, isPassword: false, + inputSuffix: "", + getInputBufferReminder: () => false, }; /** diff --git a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js index 2786d2ca0a6..75daffd1d6a 100644 --- a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js @@ -147,6 +147,7 @@ export class PaymentScreen extends Component { title: tip ? this.env._t("Change Tip") : this.env._t("Add Tip"), startingValue: value, isInputSelected: true, + inputSuffix: this.env.pos.currency.symbol, }); if (confirmed) { diff --git a/addons/point_of_sale/static/src/scss/pos.scss b/addons/point_of_sale/static/src/scss/pos.scss index abe37ed5a7b..7841e4bf17f 100644 --- a/addons/point_of_sale/static/src/scss/pos.scss +++ b/addons/point_of_sale/static/src/scss/pos.scss @@ -2551,6 +2551,13 @@ td { padding: 20px; border-radius: 3px 3px 0px 0px; border-bottom: solid 1px rgba(60,60,60,0.1); + display: flex; + flex-direction: column; +} +.pos .popup .subtitle { + padding: 5px; + font-size: 14px; + font-weight: normal; } .pos .popup .body { font-weight: normal; @@ -2597,6 +2604,22 @@ td { color: $primary; } +.pos .button .flex-column { + display: flex; + justify-content: center; + height: 40px; + gap: 2px; + flex-direction: column; +} + +.pos .button .flex-column span { + line-height: normal; +} + +.pos .button .flex-column .input-buffer-reminder { + font-weight: normal; +} + .pos .popup .button.dont-show-again { width: 130px; } @@ -2633,6 +2656,23 @@ td { height: 180px; line-height:180px; } + +.pos .input-symbol { + display: flex; + align-items: center; + gap: 14px; + justify-content: center; +} + +.pos .input-symbol .popup-input { + display: flex; + gap: 4px; +} + +.pos .input-symbol .popup-input .input-value { + flex-grow: 1; +} + .pos .popup input, .pos .popup-input { text-align: left; @@ -2682,7 +2722,7 @@ td { } .pos .popup-number .popup-input { - text-align: center; + text-align: right; } .pos .popup input:focus, .pos .popup-input.active { @@ -2730,11 +2770,14 @@ td { background: $primary; } .pos .popup.popup-number { - width: 300px; - height: 450px; + max-width: none; + width: auto; + padding: 0 10px; } .pos .footer.centered { text-align: center; + display: flex; + justify-content: center; } .pos .footer.centered .button { float: none; @@ -2773,11 +2816,6 @@ td { color: white; border-color: #444; } - -.pos .popup.popup-password { - width: 254px; - height: 510px; -} .pos .popup-password .mode-button.add, .pos .popup-password .input-button.dot { display: none; diff --git a/addons/point_of_sale/static/src/xml/Popups/NumberPopup.xml b/addons/point_of_sale/static/src/xml/Popups/NumberPopup.xml index e945bf44af9..6a923540a4d 100644 --- a/addons/point_of_sale/static/src/xml/Popups/NumberPopup.xml +++ b/addons/point_of_sale/static/src/xml/Popups/NumberPopup.xml @@ -4,10 +4,14 @@