From a19cdd6e27afdd802a98d07f178f2ad0efade8be Mon Sep 17 00:00:00 2001 From: "Loukas Wets (lowe)" Date: Wed, 5 Apr 2023 07:27:27 +0000 Subject: [PATCH] [IMP] point_of_sale,{pos_}loyalty: ux misc improvements - The calculator logo of the cash opening popup has been changed to a bill logo to be more explicite for the end user. - The cash input is autofocused at the opening of the cash opening popup. Select number input on focus and align numbers right money details popup. - Rearrange Close pos popup layout. - Set the Gift Card amount to the price of the refound if there is one. - Change pos_payement_method_view form id order to sequence. Set the order of payement methods in PayementScreen to sequence. - Fix markut issue in the chatter. Task-3215901 closes odoo/odoo#118288 Signed-off-by: Joseph Caburnay (jcb) --- addons/loyalty/__manifest__.py | 2 +- addons/loyalty/data/loyalty_data.xml | 26 +++++++++ addons/loyalty/data/loyalty_demo.xml | 27 --------- .../models/pos_payment_method.py | 6 +- addons/point_of_sale/models/pos_session.py | 10 ++-- .../point_of_sale/static/src/app/pos_store.js | 1 - .../src/css/popups/cash_opening_popup.css | 3 +- .../src/css/popups/closing_pos_popup.css | 56 ++++++++++++++----- .../static/src/js/Popups/CashOpeningPopup.js | 3 +- addons/point_of_sale/static/src/scss/pos.scss | 34 ++++++++--- .../src/xml/Popups/CashOpeningPopup.xml | 4 +- .../static/src/xml/Popups/ClosePosPopup.xml | 25 ++++++--- .../src/xml/Popups/MoneyDetailsPopup.xml | 2 +- .../xml/Screens/TicketScreen/TicketScreen.xml | 20 +++---- .../tours/helpers/TicketScreenTourMethods.js | 6 ++ addons/point_of_sale/tests/common.py | 2 +- .../views/pos_payment_method_views.xml | 1 + addons/pos_loyalty/data/gift_card_data.xml | 4 ++ addons/pos_loyalty/data/pos_loyalty_demo.xml | 4 -- .../pos_loyalty/static/src/app/pos_store.js | 9 ++- .../static/src/tours/GiftCardProgramTours.js | 33 ++++++++++- addons/pos_loyalty/tests/test_frontend.py | 18 ++++++ 22 files changed, 206 insertions(+), 90 deletions(-) diff --git a/addons/loyalty/__manifest__.py b/addons/loyalty/__manifest__.py index 8baafc33153..5e120d1211e 100644 --- a/addons/loyalty/__manifest__.py +++ b/addons/loyalty/__manifest__.py @@ -11,8 +11,8 @@ 'security/loyalty_security.xml', 'report/loyalty_report_templates.xml', 'report/loyalty_report.xml', - 'data/loyalty_data.xml', 'data/mail_template_data.xml', + 'data/loyalty_data.xml', 'wizard/loyalty_generate_wizard_views.xml', 'views/loyalty_card_views.xml', 'views/loyalty_mail_views.xml', diff --git a/addons/loyalty/data/loyalty_data.xml b/addons/loyalty/data/loyalty_data.xml index 41bcf415915..417173c10d6 100644 --- a/addons/loyalty/data/loyalty_data.xml +++ b/addons/loyalty/data/loyalty_data.xml @@ -22,4 +22,30 @@ False + + + + Gift Cards + gift_card + future + auto + True + $ + + + + discount + per_point + 1 + order + 1 + + + + 1 + money + True + + + diff --git a/addons/loyalty/data/loyalty_demo.xml b/addons/loyalty/data/loyalty_demo.xml index ad32529f4cd..f1b7b4e0d6c 100644 --- a/addons/loyalty/data/loyalty_demo.xml +++ b/addons/loyalty/data/loyalty_demo.xml @@ -72,31 +72,4 @@ - - - Gift Cards - gift_card - future - auto - True - $ - - - - - 1 - money - True - - - - - - discount - per_point - 1 - order - 1 - - diff --git a/addons/point_of_sale/models/pos_payment_method.py b/addons/point_of_sale/models/pos_payment_method.py index ce6b89bf363..1404a2cc04c 100644 --- a/addons/point_of_sale/models/pos_payment_method.py +++ b/addons/point_of_sale/models/pos_payment_method.py @@ -5,12 +5,13 @@ from odoo.exceptions import UserError class PosPaymentMethod(models.Model): _name = "pos.payment.method" _description = "Point of Sale Payment Methods" - _order = "id asc" + _order = "sequence" def _get_payment_terminal_selection(self): return [] name = fields.Char(string="Method", required=True, translate=True, help='Defines the name of the payment method that will be displayed in the Point of Sale when the payments are selected.') + sequence = fields.Integer(copy=False) outstanding_account_id = fields.Many2one('account.account', string='Outstanding Account', ondelete='restrict', @@ -81,7 +82,8 @@ class PosPaymentMethod(models.Model): pm.is_cash_count = pm.type == 'cash' def _is_write_forbidden(self, fields): - return bool(fields and self.open_session_ids) + whitelisted_fields = {'sequence'} + return bool(fields - whitelisted_fields and self.open_session_ids) def write(self, vals): if self._is_write_forbidden(set(vals.keys())): diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 7a7c65e214c..0136357e4cb 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -4,7 +4,7 @@ from collections import defaultdict from datetime import timedelta from itertools import groupby -from markupsafe import Markup +from markupsafe import Markup, escape from odoo import api, fields, models, _, Command from odoo.exceptions import AccessError, UserError, ValidationError @@ -1499,9 +1499,9 @@ class PosSession(models.Model): message = f"{state} difference: " \ f"{self.currency_id.symbol + ' ' if self.currency_id.position == 'before' else ''}" \ f"{self.currency_id.round(difference)} " \ - f"{self.currency_id.symbol if self.currency_id.position == 'after' else ''}
" + f"{self.currency_id.symbol if self.currency_id.position == 'after' else ''}" + Markup('
') if notes: - message += notes.replace('\n', Markup('
')) + message += escape(notes).replace('\n', Markup('
')) if message: self.message_post(body=message) @@ -1979,8 +1979,8 @@ class PosSession(models.Model): return { 'search_params': { 'domain': ['|', ('active', '=', False), ('active', '=', True)], - 'fields': ['name', 'is_cash_count', 'use_payment_terminal', 'split_transactions', 'type', 'image'], - 'order': 'is_cash_count desc, id', + 'fields': ['name', 'is_cash_count', 'use_payment_terminal', 'split_transactions', 'type', 'image', 'sequence'], + 'order': 'sequence', }, } diff --git a/addons/point_of_sale/static/src/app/pos_store.js b/addons/point_of_sale/static/src/app/pos_store.js index dfe73c74786..7f678586b4e 100644 --- a/addons/point_of_sale/static/src/app/pos_store.js +++ b/addons/point_of_sale/static/src/app/pos_store.js @@ -200,7 +200,6 @@ export class PosStore extends Reactive { if (!options) { return; } - // Add the product after having the extra information. this.addProductFromUi(product, options); this.numberBuffer.reset(); diff --git a/addons/point_of_sale/static/src/css/popups/cash_opening_popup.css b/addons/point_of_sale/static/src/css/popups/cash_opening_popup.css index aa1a4b97e7b..34e8ec2c52d 100644 --- a/addons/point_of_sale/static/src/css/popups/cash_opening_popup.css +++ b/addons/point_of_sale/static/src/css/popups/cash_opening_popup.css @@ -1,5 +1,5 @@ .pos .opening-cash-control .body{ - margin: 40px; + margin: 24px; } .pos .opening-cash-control .opening-cash-section { @@ -33,4 +33,5 @@ line-height: 20px; resize: none; height: 150px; + border-radius: 0px; } diff --git a/addons/point_of_sale/static/src/css/popups/closing_pos_popup.css b/addons/point_of_sale/static/src/css/popups/closing_pos_popup.css index 86f99248bed..7084395b6c7 100644 --- a/addons/point_of_sale/static/src/css/popups/closing_pos_popup.css +++ b/addons/point_of_sale/static/src/css/popups/closing_pos_popup.css @@ -8,17 +8,22 @@ padding: 3% 5%; } +.pos .close-pos-popup .body.notes{ + border-top: solid 1px rgba(60, 60, 60, 0.1); +} .pos .close-pos-popup header { display: flex; justify-content: space-between; width: auto; height: 65px; background-color: rgb(255, 255, 255); + border-bottom: solid 1px rgba(60, 60, 60, 0.1); } .pos .close-pos-popup .title, .pos .close-pos-popup .total-orders { padding: 2.5%; + border-bottom: none; } .pos .close-pos-popup .total-orders .amount { @@ -28,20 +33,38 @@ .notes-container { display: flex; justify-content: space-around; - width: 100%; - padding-top: 1%; + box-sizing: border-box; + gap:20px; + height: 120px; +} + +.pos .close-pos-popup .opening-notes-container{ + text-align: left; + display: flex; + flex-direction: column; + flex-grow: 1; + gap: 5px } .pos .close-pos-popup .opening-notes { color: darkgrey; text-align: left; - font-size: 16px; + font-weight: 350; box-sizing: border-box; - min-width: 40%; - padding: 5px 10px; - border-left: solid 3px darkgray; + line-height: 20px; overflow-y: auto; word-break: break-word; + border-radius: 0px; + resize: none; + height: 100%; +} + +.pos .close-pos-popup .closing-notes-container{ + text-align: left; + display: flex; + flex-direction: column; + flex-grow: 1; + gap: 5px; } .pos .close-pos-popup .closing-notes { @@ -49,10 +72,9 @@ font-weight: 350; box-sizing: border-box; line-height: 20px; - width: 100%; - min-width: 60%; - min-height: 100px; resize: none; + border-radius: 0px; + height: 100%; } .pos .close-pos-popup .payment-methods-overview { @@ -71,7 +93,7 @@ .pos .close-pos-popup .flex { display: flex; -} + max-width: 200px;} .pos .close-pos-popup th:nth-child(1), .pos .close-pos-popup td:nth-child(1) { @@ -92,7 +114,7 @@ .pos .close-pos-popup th:nth-child(4), .pos .close-pos-popup td:nth-child(4) { - text-align: left; + text-align: right; padding-left: 10px; } .pos .close-pos-popup .payment-methods-overview table .pos-input { @@ -119,7 +141,9 @@ } .pos .close-pos-popup .payment-methods-overview .cash-overview { - border-left: solid 2px #555555; + border-left: solid 2px darkgrey; + color: darkgrey; + font-size: 14px; } .pos .close-pos-popup .payment-methods-overview .cash-overview tr td:first-child { @@ -173,7 +197,13 @@ .pos .close-pos-popup .footer .small.button { float: right; width: 6%; - min-width: 45px; + min-width: 120px; +} + +.pos .close-pos-popup .footer .small.button .daily.sale { + font-size : 14px; + display: inline; + margin-right: 10px; } .pos .close-pos-popup .footer .button.disabled { diff --git a/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js b/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js index 72870bc51d0..48779c0391e 100644 --- a/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js @@ -1,7 +1,7 @@ /** @odoo-module */ import { AbstractAwaitablePopup } from "@point_of_sale/js/Popups/AbstractAwaitablePopup"; -import { useService } from "@web/core/utils/hooks"; +import { useAutofocus, useService } from "@web/core/utils/hooks"; import { usePos } from "@point_of_sale/app/pos_hook"; import { MoneyDetailsPopup } from "./MoneyDetailsPopup"; import { useState } from "@odoo/owl"; @@ -21,6 +21,7 @@ export class CashOpeningPopup extends AbstractAwaitablePopup { }); this.popup = useService("popup"); this.orm = useService("orm"); + useAutofocus({ refName: "cash-input" }); } //@override async confirm() { diff --git a/addons/point_of_sale/static/src/scss/pos.scss b/addons/point_of_sale/static/src/scss/pos.scss index 7841e4bf17f..fbcf0f12857 100644 --- a/addons/point_of_sale/static/src/scss/pos.scss +++ b/addons/point_of_sale/static/src/scss/pos.scss @@ -466,6 +466,8 @@ td { } .pos .oe_link_icon{ cursor:pointer; + text-align: right; + width: 50px; } /* ********* Contains everything below the bar ********* */ @@ -2516,12 +2518,14 @@ td { height:100%; background-color: rgba(0,0,0,0.5); z-index:1000; + display:flex; + align-items:center; + justify-content:center; } .pos .modal-dialog header{ position: relative; } .pos .modal-dialog .popup{ - position: absolute; margin: auto; max-width:500px; width: 100%; @@ -2533,10 +2537,6 @@ td { z-index:1200; font-family: 'Lato'; font-family: Lato; - /* position the popup at center and and still making it draggable*/ - top: 50%; - left: 50%; - transform: translate(-50%, -50%); } .pos .modal-dialog .popup-med{ @@ -2562,7 +2562,7 @@ td { .pos .popup .body { font-weight: normal; font-size: 18px; - margin: 16px; + padding: 16px; white-space: pre-line; } @@ -2627,6 +2627,18 @@ td { .pos .popup .button.icon { width: 40px; font-size: 20px; + display: flex; + justify-content: center; + align-items: center; +} +.pos .popup .button.icon.ClosePosPopup{ + height: 35px; + font-size: 20px; + margin-top: 0px; + margin-right: 0px; + display: flex; + justify-content: center; + align-items: center; } .pos .popup .button:active{ color: white; @@ -3134,6 +3146,10 @@ td { overflow-y: auto; font-size: medium; } +.pos .orders .cashier { + font-style: italic; + font-size: 12px; +} .pos .orders .header-row{ display: flex; @@ -3173,6 +3189,7 @@ td { position: sticky; top: 0; background: $gray-300; + z-index: 100; } .ticket-screen .controls button.search { margin: 0; @@ -3185,6 +3202,9 @@ td { .ticket-screen .rightpane { width: auto; } + .pos .orders { + position: sticky; + } } .pos .orders .order-row:hover, .pos .orders .order-row.highlight { @@ -3252,7 +3272,7 @@ td { justify-content: space-between; align-items: center; padding: 0px 10px; - flex: 0 0 80px; + flex: 0 0 80px } .ticket-screen .controls button { diff --git a/addons/point_of_sale/static/src/xml/Popups/CashOpeningPopup.xml b/addons/point_of_sale/static/src/xml/Popups/CashOpeningPopup.xml index ee14ff9830a..c71b8ace04a 100644 --- a/addons/point_of_sale/static/src/xml/Popups/CashOpeningPopup.xml +++ b/addons/point_of_sale/static/src/xml/Popups/CashOpeningPopup.xml @@ -9,9 +9,9 @@
Opening cash
- +
- +
diff --git a/addons/point_of_sale/static/src/xml/Popups/ClosePosPopup.xml b/addons/point_of_sale/static/src/xml/Popups/ClosePosPopup.xml index b971ef245f5..5693dbac1de 100644 --- a/addons/point_of_sale/static/src/xml/Popups/ClosePosPopup.xml +++ b/addons/point_of_sale/static/src/xml/Popups/ClosePosPopup.xml @@ -17,7 +17,7 @@ Payment Method Expected - Counted + Counted Difference @@ -27,9 +27,9 @@ - -
- + +
+
@@ -65,17 +65,25 @@ - +
+ +
-
- +
+ Opening note + +
+
+ Closing note +