[REF] pos_sale: remove unused mobile order management screen

The mobile order management screen has never worked. A previous commit
partially fixed it and caused it to now be rendered, but it's always
rendered in a way that makes it no different from the desktop order
management screen. The code has been dead for so long that allowing the
code to go through the dead path crashes and after fixing the crashes
the layout is broken. As such, this commit removes it entirely, and if
the flow needs improvement on mobile it will be done as part of a
separate task instead.

Part-of: odoo/odoo#122035
This commit is contained in:
Samuel Degueldre
2023-05-24 14:27:58 +02:00
parent cfcd25df39
commit d49476e0f8
4 changed files with 5 additions and 79 deletions
+1 -10
View File
@@ -28,16 +28,7 @@ This module adds a custom Sales Team for the Point of Sale. This enables you to
'auto_install': True,
'assets': {
'point_of_sale._assets_pos': [
'pos_sale/static/src/css/pos_sale.css',
'pos_sale/static/src/js/models.js',
'pos_sale/static/src/js/SetSaleOrderButton.js',
'pos_sale/static/src/js/OrderManagementScreen/MobileSaleOrderManagementScreen.js',
'pos_sale/static/src/js/OrderManagementScreen/SaleOrderFetcher.js',
'pos_sale/static/src/js/OrderManagementScreen/SaleOrderList.js',
'pos_sale/static/src/js/OrderManagementScreen/SaleOrderManagementControlPanel.js',
'pos_sale/static/src/js/OrderManagementScreen/SaleOrderManagementScreen.js',
'pos_sale/static/src/js/OrderManagementScreen/SaleOrderRow.js',
'pos_sale/static/src/xml/**/*',
'pos_sale/static/src/**/*',
],
'web.assets_tests': [
'pos_sale/static/tests/**/*',
@@ -1,18 +0,0 @@
/** @odoo-module */
import { SaleOrderManagementScreen } from "@pos_sale/js/OrderManagementScreen/SaleOrderManagementScreen";
import { registry } from "@web/core/registry";
import { useState } from "@odoo/owl";
export class MobileSaleOrderManagementScreen extends SaleOrderManagementScreen {
static template = "MobileSaleOrderManagementScreen";
setup() {
super.setup();
this.mobileState = useState({ showDetails: false });
}
async onClickSaleOrder() {
await this.super();
this.mobileState.showDetails = true;
}
}
registry.category("pos_screens").add("MobileSaleOrderManagementScreen", MobileSaleOrderManagementScreen);
@@ -2,31 +2,16 @@
import { ProductScreen } from "@point_of_sale/js/Screens/ProductScreen/ProductScreen";
import { usePos } from "@point_of_sale/app/pos_hook";
import { Component, useState } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
import { Component } from "@odoo/owl";
export class SetSaleOrderButton extends Component {
static template = "SetSaleOrderButton";
setup() {
super.setup();
this.pos = usePos();
this.ui = useState(useService("ui"));
this.orm = useService("orm");
}
async click() {
// FIXME POSREF why are we calling browse for a ping?
// Why don't we let the order management screen deal with the offline error?
await this.orm.call("sale.order", "browse", [[]]);
const screen = this.ui.isSmall
? "MobileSaleOrderManagementScreen"
: "SaleOrderManagementScreen";
this.pos.showScreen(screen);
this.pos.showScreen("SaleOrderManagementScreen");
}
}
ProductScreen.addControlButton({
component: SetSaleOrderButton,
condition: function () {
return true;
},
});
ProductScreen.addControlButton({ component: SetSaleOrderButton });
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<div t-name="MobileSaleOrderManagementScreen" class="screen-full-width" owl="1">
<div class="order-management-screen screen" t-att-class="{ oe_hidden: !props.isShown }">
<div t-if="mobileState.showDetails" class="leftpane">
<OrderDetails order="orderManagementContext.selectedOrder" />
<div class="pads">
<div class="control-buttons">
<t t-foreach="controlButtons" t-as="cb" t-key="cb.name">
<t t-component="cb.component" t-key="cb.name" />
</t>
</div>
<div class="subpads">
<ActionpadWidget partner="selectedPartner" />
<NumpadWidget />
</div>
</div>
<div class="back-to-list" t-on-click="() => { mobileState.showDetails = false; }">
<span>Back to list</span>
</div>
</div>
<div t-else="" class="rightpane">
<div class="flex-container">
<SaleOrderManagementControlPanel />
<SaleOrderList orders="orders" initHighlightedOrder="orderManagementContext.selectedOrder" />
</div>
</div>
</div>
</div>
</templates>