[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) <jcb@odoo.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
<t t-else=""> Discard</t>
|
||||
</div>
|
||||
<div class="top-right-buttons">
|
||||
<div t-if="state.detailIsShown && state.editModeProps.partner.id" class="button more-info">
|
||||
<a t-att-href="partnerLink" target="_blank"> More info</a>
|
||||
<div t-if="state.detailIsShown and state.editModeProps.partner.id" class="button more-info" t-on-click="goToOrders">
|
||||
<span> Orders</span>
|
||||
</div>
|
||||
<a t-if="state.detailIsShown && state.editModeProps.partner.id" class="button more-info" t-att-href="partnerLink" target="_blank"> More info</a>
|
||||
<div class="search-bar-container sb-partner" t-if="!state.detailIsShown">
|
||||
<div class="pos-search-bar">
|
||||
<i class="fa fa-search" t-on-click="_onPressEnterKey"/>
|
||||
|
||||
Reference in New Issue
Block a user