[FIX] pos*: add missing arguments forwarding in _super calls

*: l10n_fr_pos_cert, l10n_gcc_pos, pos_hr, pos_loyalty, pos_mercury,
pos_restaurant, pos_restaurant_adyen

In odoo/odoo#109928 the custom inheritance system of the pos was removed
and a bunch of modules were adapted. In a lot of those places, the
_super calls didn't forward the arguments to the super method, resulting
in broken methods. This commits fixes that.

closes odoo/odoo#110962

Related: odoo/enterprise#36269
Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
Samuel Degueldre
2023-01-25 16:37:10 +01:00
parent 8893454e29
commit 7c3194ef73
18 changed files with 37 additions and 37 deletions
@@ -6,7 +6,7 @@ import { ClosePosPopup } from "@point_of_sale/js/Popups/ClosePosPopup";
patch(Chrome.prototype, "l10n_fr_pos_cert.Chrome", {
async start() {
await this._super();
await this._super(...arguments);
if (this.env.pos.is_french_country() && this.env.pos.pos_session.start_at) {
const now = Date.now();
const limitDate = new Date(this.env.pos.pos_session.start_at);
@@ -15,6 +15,6 @@ patch(ClosePosPopup.prototype, "l10n_fr_pos_cert.ClosePosPopup", {
return isOutdated;
},
canCancel() {
return this._super() && !this.sessionIsOutdated();
return this._super(...arguments) && !this.sessionIsOutdated();
},
});
@@ -5,7 +5,7 @@ import { patch } from "@web/core/utils/patch";
patch(OrderReceipt.prototype, "l10n_gcc_pos.OrderReceipt", {
get receiptEnv() {
const receipt_render_env = this._super();
const receipt_render_env = this._super(...arguments);
const receipt = receipt_render_env.receipt;
const country = receipt_render_env.order.pos.company.country;
receipt.is_gcc_country = ["SA", "AE", "BH", "OM", "QA", "KW"].includes(
+2 -2
View File
@@ -17,13 +17,13 @@ patch(CashierName.prototype, "pos_hr.CashierName", {
const cashier = this.env.pos.get_cashier();
return `/web/image/hr.employee/${cashier.id}/avatar_128`;
}
return this._super();
return this._super(...arguments);
},
//@Override
get cssClass() {
if (this.env.pos.config.module_pos_hr) {
return { oe_status: true };
}
return this._super();
return this._super(...arguments);
},
});
+3 -3
View File
@@ -12,14 +12,14 @@ patch(Chrome.prototype, "pos_hr.Chrome", {
},
get showCashMoveButton() {
return (
this._super() &&
this._super(...arguments) &&
(!this.env.pos.cashier || this.env.pos.cashier.role == "manager")
);
},
shouldShowCashControl() {
if (this.env.pos.config.module_pos_hr) {
return this._super() && this.env.pos.hasLoggedIn;
return this._super(...arguments) && this.env.pos.hasLoggedIn;
}
return this._super();
return this._super(...arguments);
},
});
+1 -1
View File
@@ -17,7 +17,7 @@ patch(LoginScreen.prototype, "pos_hr.LoginScreen methods", {
useBarcodeReader({ cashier: this.barcodeCashierAction }, true);
},
async selectCashier() {
if (await this._super()) {
if (await this._super(...arguments)) {
this.back();
}
},
+1 -1
View File
@@ -6,6 +6,6 @@ import { patch } from "@web/core/utils/patch";
patch(PaymentScreen.prototype, "pos_hr.PaymentScreen", {
async _finalizeValidation() {
this.currentOrder.cashier = this.env.pos.get_cashier();
await this._super();
await this._super(...arguments);
},
});
+2 -2
View File
@@ -48,13 +48,13 @@ patch(PosGlobalState.prototype, "pos_hr.PosGlobalState", {
if (this.config.module_pos_hr) {
return this.cashier;
}
return this._super();
return this._super(...arguments);
},
get_cashier_user_id() {
if (this.config.module_pos_hr) {
return this.cashier.user_id ? this.cashier.user_id : null;
}
return this._super();
return this._super(...arguments);
},
});
@@ -7,7 +7,7 @@ patch(Orderline.prototype, "pos_loyalty.Orderline", {
get addedClasses() {
return Object.assign(
{ "program-reward": this.props.line.is_reward_line },
this._super()
this._super(...arguments)
);
},
_isGiftCardOrEWalletReward() {
@@ -118,7 +118,7 @@ patch(PaymentScreen.prototype, "pos_mercury.PaymentScreen", {
* @override
*/
get _getNumberBufferConfig() {
const res = this._super();
const res = this._super(...arguments);
res["useWithBarcode"] = true;
return res;
},
@@ -12,7 +12,7 @@ patch(Chrome.prototype, "pos_restaurant.Chrome", {
* @override
*/
async start() {
await this._super();
await this._super(...arguments);
if (this.env.pos.config.iface_floorplan) {
this._setActivityListeners();
}
@@ -36,7 +36,7 @@ patch(Chrome.prototype, "pos_restaurant.Chrome", {
const table = this.env.pos.table;
return { name: "FloorScreen", props: { floor: table ? table.floor : null } };
} else {
return this._super();
return this._super(...arguments);
}
},
_setActivityListeners() {
@@ -96,6 +96,6 @@ patch(Chrome.prototype, "pos_restaurant.Chrome", {
window.removeEventListener(event, IDLE_TIMER_SETTER);
}
}
await this._super();
await this._super(...arguments);
},
});
@@ -18,7 +18,7 @@ patch(TicketButton.prototype, "pos_restaurant.TicketButton", {
this.showScreen("TicketScreen");
}
} else {
this._super();
this._super(...arguments);
}
},
/**
@@ -32,7 +32,7 @@ patch(TicketButton.prototype, "pos_restaurant.TicketButton", {
if (this.env.pos.config.iface_floorplan && this.env.pos.table) {
return this.env.pos.getTableOrders(this.env.pos.table.id).length;
} else {
return this._super();
return this._super(...arguments);
}
},
});
@@ -31,13 +31,13 @@ patch(PaymentScreen.prototype, "pos_restaurant.PaymentScreen", {
get nextScreen() {
const order = this.currentOrder;
if (!this.env.pos.config.set_tip_after_payment || order.is_tipped) {
return this._super();
return this._super(...arguments);
}
// Take the first payment method as the main payment.
const mainPayment = order.get_paymentlines()[0];
if (mainPayment.canBeAdjusted()) {
return "TipScreen";
}
return this._super();
return this._super(...arguments);
},
});
@@ -8,7 +8,7 @@ patch(Orderline.prototype, "pos_restaurant.Orderline", {
* @override
*/
get addedClasses() {
const res = this._super();
const res = this._super(...arguments);
Object.assign(res, {
dirty: this.props.line.mp_dirty,
skip: this.props.line.mp_skip,
@@ -34,6 +34,6 @@ patch(Orderline.prototype, "pos_restaurant.Orderline", {
} else {
this.mp_dbclk_time = new Date().getTime();
}
this._super();
this._super(...arguments);
},
});
@@ -23,7 +23,7 @@ patch(ReceiptScreen.prototype, "pos_restaurant.ReceiptScreen", {
//@override
_addNewOrder() {
if (!this.env.pos.config.iface_floorplan) {
this._super();
this._super(...arguments);
}
},
//@override
@@ -32,7 +32,7 @@ patch(ReceiptScreen.prototype, "pos_restaurant.ReceiptScreen", {
const table = this.env.pos.table;
return { name: "FloorScreen", props: { floor: table ? table.floor : null } };
} else {
return this._super();
return this._super(...arguments);
}
},
});
@@ -11,7 +11,7 @@ const { useState } = owl;
patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
close() {
if (!this.env.pos.config.iface_floorplan) {
this._super();
this._super(...arguments);
} else {
const order = this.env.pos.get_order();
if (order) {
@@ -23,10 +23,10 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
}
},
_getScreenToStatusMap() {
return Object.assign(this._super(), {
return Object.assign(this._super(...arguments), {
PaymentScreen: this.env.pos.config.set_tip_after_payment
? "OPEN"
: this._super().PaymentScreen,
: this._super(...arguments).PaymentScreen,
TipScreen: "TIPPING",
});
},
@@ -36,9 +36,9 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
//@override
_getSearchFields() {
if (!this.env.pos.config.iface_floorplan) {
return this._super();
return this._super(...arguments);
}
return Object.assign({}, this._super(), {
return Object.assign({}, this._super(...arguments), {
TABLE: {
repr: this.getTable.bind(this),
displayName: this.env._t("Table"),
@@ -59,13 +59,13 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
shouldShowNewOrderButton() {
return this.env.pos.config.iface_floorplan
? Boolean(this.env.pos.table)
: this._super();
: this._super(...arguments);
},
_getOrderList() {
if (this.env.pos.table) {
return this.env.pos.getTableOrders(this.env.pos.table.id);
}
return this._super();
return this._super(...arguments);
},
async settleTips() {
// set tip in each order
@@ -150,7 +150,7 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
});
},
_getOrderStates() {
const result = this._super();
const result = this._super(...arguments);
if (this.env.pos.config.set_tip_after_payment) {
result.delete("PAYMENT");
result.set("OPEN", { text: this.env._t("Open"), indented: true });
@@ -166,7 +166,7 @@ patch(TicketScreen.prototype, "pos_restaurant.TicketScreen", {
: Object.values(this.env.pos.tables_by_id)[0]
);
}
this._super();
this._super(...arguments);
},
isDefaultOrderEmpty(order) {
if (this.env.pos.config.iface_floorplan) {
@@ -65,7 +65,7 @@ patch(PosGlobalState.prototype, "pos_restaurant.PosGlobalState", {
},
//@override
add_new_order() {
const order = this._super();
const order = this._super(...arguments);
this.ordersToUpdateSet.add(order);
return order;
},
@@ -86,7 +86,7 @@ patch(PosGlobalState.prototype, "pos_restaurant.PosGlobalState", {
//@override
async load_orders() {
this.loadingOrderState = true;
await this._super();
await this._super(...arguments);
this.loadingOrderState = false;
},
_loadRestaurantPrinter(printers) {
@@ -4,7 +4,7 @@ import { PaymentAdyen } from "@pos_adyen/js/payment_adyen";
PaymentAdyen.include({
_adyen_pay_data: function () {
var data = this._super();
var data = this._super(...arguments);
if (data.SaleToPOIRequest.PaymentRequest.SaleData.SaleToAcquirerData) {
data.SaleToPOIRequest.PaymentRequest.SaleData.SaleToAcquirerData +=