feat: increase product load limit and add order summary patches for optimized POS navigation
This commit is contained in:
parent
277d740996
commit
0dcd17039f
@ -28,6 +28,8 @@ Features
|
|||||||
'pos_ui_optimization/static/src/app/components/order_display/order_display_patch.xml',
|
'pos_ui_optimization/static/src/app/components/order_display/order_display_patch.xml',
|
||||||
'pos_ui_optimization/static/src/app/screens/product_screen/product_screen_patch.js',
|
'pos_ui_optimization/static/src/app/screens/product_screen/product_screen_patch.js',
|
||||||
'pos_ui_optimization/static/src/app/screens/product_screen/product_screen_patch.xml',
|
'pos_ui_optimization/static/src/app/screens/product_screen/product_screen_patch.xml',
|
||||||
|
'pos_ui_optimization/static/src/app/screens/product_screen/order_summary_patch.js',
|
||||||
|
'pos_ui_optimization/static/src/app/screens/product_screen/order_summary_patch.xml',
|
||||||
# Payment screen patches
|
# Payment screen patches
|
||||||
'pos_ui_optimization/static/src/app/screens/payment_screen/payment_screen_patch.xml',
|
'pos_ui_optimization/static/src/app/screens/payment_screen/payment_screen_patch.xml',
|
||||||
# Portrait mode — service must load first
|
# Portrait mode — service must load first
|
||||||
|
|||||||
45
static/src/app/screens/product_screen/order_summary_patch.js
Normal file
45
static/src/app/screens/product_screen/order_summary_patch.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { OrderSummary } from "@point_of_sale/app/screens/product_screen/order_summary/order_summary";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
|
patch(OrderSummary.prototype, {
|
||||||
|
get currentOrder() {
|
||||||
|
return this.pos.selectedOrder || null;
|
||||||
|
},
|
||||||
|
|
||||||
|
async updateSelectedOrderline({ buffer, key }) {
|
||||||
|
const order = this.pos.getOrder();
|
||||||
|
if (!order) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return super.updateSelectedOrderline(...arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
showUnbookButton() {
|
||||||
|
const order = this.pos.getOrder();
|
||||||
|
if (!order) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.pos.selectedTable) {
|
||||||
|
return (
|
||||||
|
this.pos.config.module_pos_restaurant &&
|
||||||
|
!this.pos.models["pos.order"].some(
|
||||||
|
(o) =>
|
||||||
|
o.table_id?.id === this.pos.selectedTable.id &&
|
||||||
|
o.finalized === false &&
|
||||||
|
!o.isBooked
|
||||||
|
) &&
|
||||||
|
order.lines.length === 0 &&
|
||||||
|
!order.hasCourses()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
this.pos.config.module_pos_restaurant &&
|
||||||
|
!order.finalized &&
|
||||||
|
order.isBooked &&
|
||||||
|
order.isEmpty() &&
|
||||||
|
!order.hasCourses()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates id="template" xml:space="preserve">
|
||||||
|
<t t-inherit="point_of_sale.OrderSummary" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//OrderDisplay" position="attributes">
|
||||||
|
<attribute name="t-if">currentOrder</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
@ -7,7 +7,7 @@ import { useEffect } from "@odoo/owl";
|
|||||||
patch(ProductScreen.prototype, {
|
patch(ProductScreen.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
super.setup();
|
super.setup();
|
||||||
this.state.displayedProductsCount = 40;
|
this.state.displayedProductsCount = 80;
|
||||||
|
|
||||||
const originalOnScroll = this.onScroll;
|
const originalOnScroll = this.onScroll;
|
||||||
this.onScroll = (ev) => {
|
this.onScroll = (ev) => {
|
||||||
@ -15,22 +15,33 @@ patch(ProductScreen.prototype, {
|
|||||||
originalOnScroll(ev);
|
originalOnScroll(ev);
|
||||||
}
|
}
|
||||||
const el = ev.target;
|
const el = ev.target;
|
||||||
if (el && el.scrollTop + el.clientHeight >= el.scrollHeight - 200) {
|
if (el && el.scrollTop + el.clientHeight >= el.scrollHeight - 400) {
|
||||||
const totalCount = this.pos.productToDisplayByCateg.reduce((acc, cat) => acc + cat[1].length, 0);
|
const totalCount = this.pos.productToDisplayByCateg.reduce((acc, cat) => acc + cat[1].length, 0);
|
||||||
if (this.state.displayedProductsCount < totalCount) {
|
if (this.state.displayedProductsCount < totalCount) {
|
||||||
this.state.displayedProductsCount += 40;
|
this.state.displayedProductsCount += 80;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() => {
|
() => {
|
||||||
this.state.displayedProductsCount = 40;
|
this.state.displayedProductsCount = 80;
|
||||||
},
|
},
|
||||||
() => [this.pos.searchProductWord, this.pos.selectedCategory]
|
() => [this.pos.searchProductWord, this.pos.selectedCategory]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get currentOrder() {
|
||||||
|
return this.pos.getOrder() || {
|
||||||
|
lines: [],
|
||||||
|
totalQuantity: 0,
|
||||||
|
isEmpty() { return true; },
|
||||||
|
getPartner() { return null; },
|
||||||
|
deselectOrderline() {},
|
||||||
|
assertEditable() {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
get productToDisplayByCategLimited() {
|
get productToDisplayByCategLimited() {
|
||||||
const fullList = this.pos.productToDisplayByCateg;
|
const fullList = this.pos.productToDisplayByCateg;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|||||||
@ -7,5 +7,9 @@
|
|||||||
<xpath expr="//ProductCard" position="attributes">
|
<xpath expr="//ProductCard" position="attributes">
|
||||||
<attribute name="t-on-touchmove">longPressHandlers.onTouchEnd</attribute>
|
<attribute name="t-on-touchmove">longPressHandlers.onTouchEnd</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//button[hasclass('pay-button')]" position="attributes">
|
||||||
|
<attribute name="t-if">!pos.scanning and currentOrder</attribute>
|
||||||
|
<attribute name="t-attf-class">{{ currentOrder && currentOrder.isEmpty() ? 'btn-secondary' : 'btn-primary' }}</attribute>
|
||||||
|
</xpath>
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
|||||||
@ -91,6 +91,10 @@
|
|||||||
padding-bottom: 122px !important;
|
padding-bottom: 122px !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
.products-widget {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
.overflow-y-auto {
|
.overflow-y-auto {
|
||||||
flex-grow: 1 !important;
|
flex-grow: 1 !important;
|
||||||
flex-shrink: 1 !important;
|
flex-shrink: 1 !important;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user