From 71284f4998d24dc3bf413a505a316e29bf2b978c Mon Sep 17 00:00:00 2001 From: vlst Date: Thu, 15 Jun 2023 13:10:27 +0000 Subject: [PATCH] [IMP] point_of_sale: access customer's orders In the pos one might often need to see the orders of a specific customer. In order to accomplish this, a pos user would need to search for the customer's name in the orders screen. In order to simplify the flow, this PR introduces a new button on the customer's page that can be used to navigate directly to the orders page with the customer's name prefilled in the search bar. closes odoo/odoo#125222 Task: 3298155 Signed-off-by: Joseph Caburnay (jcb) --- .../app/screens/partner_list/partner_list.js | 21 +++++++++++++++++-- .../app/screens/partner_list/partner_list.xml | 5 +++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js index 8b594894e3b..dfd6525b9e8 100644 --- a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js +++ b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.js @@ -51,14 +51,31 @@ export class PartnerListScreen extends Component { this.partnerEditor = {}; // create an imperative handle for PartnerDetailsEdit } // Lifecycle hooks - back() { - if (this.state.detailIsShown) { + back(force = false) { + if (this.state.detailIsShown && !force) { this.state.detailIsShown = false; } else { this.props.resolve({ confirmed: false, payload: false }); this.pos.closeTempScreen(); } } + + goToOrders() { + this.back(true); + const partner = this.state.editModeProps.partner; + const partnerHasActiveOrders = this.pos + .get_order_list() + .some((order) => order.partner?.id === partner.id); + const ui = { + searchDetails: { + fieldName: "PARTNER", + searchTerm: partner.name, + }, + filter: partnerHasActiveOrders ? "" : "SYNCED", + }; + this.pos.showScreen("TicketScreen", { ui }); + } + confirm() { this.props.resolve({ confirmed: true, payload: this.state.selectedPartner }); this.pos.closeTempScreen(); diff --git a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.xml b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.xml index ff689cf716b..c9d46e6914e 100644 --- a/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.xml +++ b/addons/point_of_sale/static/src/app/screens/partner_list/partner_list.xml @@ -22,9 +22,10 @@ Discard
-
- More info +
+ Orders
+ More info