[REF] point_of_sale, pos_restaurant, pos_sale: remove useless base class
The IndependentToOrderScreen base class is used when a main screen should not be stored on the order (so that it can be restored when the order is selected again). Its implementation is simply a class with a static flag, and a super simple close method which just calls the equivalent method on the pos store. It has been removed and the classes extending it have been adapted. Part-of: odoo/odoo#122035
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { Component } from "@odoo/owl";
|
||||
import { usePos } from "@point_of_sale/app/pos_hook";
|
||||
|
||||
export class IndependentToOrderScreen extends Component {
|
||||
static storeOnOrder = false;
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.pos = usePos();
|
||||
}
|
||||
close() {
|
||||
this.pos.closeScreen();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { Order } from "@point_of_sale/js/models";
|
||||
import { IndependentToOrderScreen } from "@point_of_sale/js/Misc/IndependentToOrderScreen";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { deserializeDateTime } from "@web/core/l10n/dates";
|
||||
@@ -18,12 +17,13 @@ import { OrderDetails } from "../TicketScreen/OrderDetails";
|
||||
import { ReprintReceiptButton } from "./ControlButtons/ReprintReceiptButton";
|
||||
import { SearchBar } from "../../Misc/SearchBar";
|
||||
import { usePos } from "@point_of_sale/app/pos_hook";
|
||||
import { onMounted, useState } from "@odoo/owl";
|
||||
import { Component, onMounted, useState } from "@odoo/owl";
|
||||
import { sprintf } from "@web/core/utils/strings";
|
||||
|
||||
const { DateTime } = luxon;
|
||||
|
||||
export class TicketScreen extends IndependentToOrderScreen {
|
||||
export class TicketScreen extends Component {
|
||||
static storeOnOrder = false;
|
||||
static template = "TicketScreen";
|
||||
static components = {
|
||||
ActionpadWidget,
|
||||
@@ -80,9 +80,6 @@ export class TicketScreen extends IndependentToOrderScreen {
|
||||
}
|
||||
//#endregion
|
||||
//#region EVENT HANDLERS
|
||||
onCloseScreen() {
|
||||
this.close();
|
||||
}
|
||||
async onFilterSelected(selectedFilter) {
|
||||
this._state.ui.filter = selectedFilter;
|
||||
if (this._state.ui.filter == "SYNCED") {
|
||||
@@ -282,7 +279,7 @@ export class TicketScreen extends IndependentToOrderScreen {
|
||||
globalState.set_order(destinationOrder);
|
||||
}
|
||||
|
||||
this.onCloseScreen();
|
||||
this.pos.closeScreen();
|
||||
}
|
||||
//#endregion
|
||||
//#region PUBLIC METHODS
|
||||
@@ -564,7 +561,7 @@ export class TicketScreen extends IndependentToOrderScreen {
|
||||
globalState.sendDraftToServer();
|
||||
}
|
||||
globalState.set_order(order);
|
||||
this.close();
|
||||
this.pos.closeScreen();
|
||||
}
|
||||
_getOrderList() {
|
||||
return this.pos.globalState.get_order_list();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="controls">
|
||||
<t t-if="!ui.isSmall || !state.showSearchBar">
|
||||
<div class="buttons">
|
||||
<button class="discard" t-on-click="() => this.onCloseScreen()">
|
||||
<button class="discard" t-on-click="() => this.pos.closeScreen()">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-angle-double-left"/>
|
||||
</span>
|
||||
|
||||
@@ -41,7 +41,7 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
|
||||
// we came from the FloorScreen
|
||||
const orderTable = order.getTable();
|
||||
await globalState.setTable(orderTable, order.uid);
|
||||
this.close();
|
||||
this.pos.closeScreen();
|
||||
},
|
||||
get allowNewOrders() {
|
||||
return this.pos.globalState.config.module_pos_restaurant
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<!-- Replace the customer button by the payment button, the customer button will be added in the mixins -->
|
||||
<xpath expr="//button[hasclass('set-partner')]" position="after">
|
||||
<button t-on-click="clickPay" class="button pay-order-button" t-att-class="{ 'highlight': this.highlightPay }" t-if="this.swapButton">
|
||||
<button t-on-click="() => pos.globalState.get_order().pay()" class="button pay-order-button" t-att-class="{ 'highlight': this.highlightPay }" t-if="this.swapButton">
|
||||
<i class="oi oi-chevron-right" role="img" aria-label="Pay" title="Pay" />
|
||||
Payment
|
||||
</button>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { parseFloat } from "@web/views/fields/parsers";
|
||||
import { useBus, useService } from "@web/core/utils/hooks";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { ControlButtonsMixin } from "@point_of_sale/js/ControlButtonsMixin";
|
||||
import { IndependentToOrderScreen } from "@point_of_sale/js/Misc/IndependentToOrderScreen";
|
||||
import { Orderline } from "@point_of_sale/js/models";
|
||||
|
||||
import { SelectionPopup } from "@point_of_sale/js/Popups/SelectionPopup";
|
||||
@@ -15,7 +14,7 @@ import { NumberPopup } from "@point_of_sale/js/Popups/NumberPopup";
|
||||
|
||||
import { SaleOrderList } from "./SaleOrderList";
|
||||
import { SaleOrderManagementControlPanel } from "./SaleOrderManagementControlPanel";
|
||||
import { onMounted, useRef } from "@odoo/owl";
|
||||
import { Component, onMounted, useRef } from "@odoo/owl";
|
||||
import { usePos } from "@point_of_sale/app/pos_hook";
|
||||
|
||||
/**
|
||||
@@ -27,7 +26,8 @@ function getId(fieldVal) {
|
||||
return fieldVal && fieldVal[0];
|
||||
}
|
||||
|
||||
export class SaleOrderManagementScreen extends ControlButtonsMixin(IndependentToOrderScreen) {
|
||||
export class SaleOrderManagementScreen extends ControlButtonsMixin(Component) {
|
||||
static storeOnOrder = false;
|
||||
static components = { SaleOrderList, SaleOrderManagementControlPanel };
|
||||
static template = "SaleOrderManagementScreen";
|
||||
|
||||
@@ -377,7 +377,7 @@ export class SaleOrderManagementScreen extends ControlButtonsMixin(IndependentTo
|
||||
}
|
||||
}
|
||||
|
||||
this.close();
|
||||
this.pos.closeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
<t t-name="SaleOrderManagementControlPanel" owl="1">
|
||||
<div class="control-panel">
|
||||
<div class="item button back" t-on-click="() => this.props.close()">
|
||||
<div class="item button back" t-on-click="() => pos.closeScreen()">
|
||||
<i class="fa fa-angle-double-left"></i>
|
||||
<span t-if="!ui.isSmall"> Back</span>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<div class="rightpane">
|
||||
<div class="flex-container">
|
||||
<SaleOrderManagementControlPanel
|
||||
close.bind="close"
|
||||
onSearch.bind="onSearch"
|
||||
onPrevPage.bind="onPrevPage"
|
||||
onNextPage.bind="onNextPage" />
|
||||
|
||||
Reference in New Issue
Block a user