[FIX] pos_self_order: kiosk print receipt when nothing to pay
Before this commit: =================== If there is an order with a total amount of 0 in kiosk mode, then after the cart page it is redirected to the home page without printing a receipt. After this commit: ================== with this commit, if an order amount is 0 then it will redirect to the confirmation/receipt page like a normal order with the amount without redirecting to the payment page. task - 3773450 closes odoo/odoo#155826 Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit is contained in:
@@ -58,10 +58,6 @@ export class OrderWidget extends Component {
|
||||
disabled = !kioskPayment && !isMobilePayment;
|
||||
}
|
||||
|
||||
if (this.selfOrder.currentOrder.amount_total === 0) {
|
||||
label = _t("Order");
|
||||
}
|
||||
|
||||
return { label, disabled };
|
||||
}
|
||||
|
||||
|
||||
@@ -195,11 +195,22 @@ export class SelfOrder extends Reactive {
|
||||
}
|
||||
|
||||
get currentOrder() {
|
||||
if (this.editedOrder && this.editedOrder.state === "draft") {
|
||||
if (
|
||||
this.editedOrder &&
|
||||
(this.editedOrder.state === "draft" ||
|
||||
(this.editedOrder.state === "paid" &&
|
||||
this.editedOrder.amount_total === 0 &&
|
||||
this.config.self_ordering_mode === "kiosk"))
|
||||
) {
|
||||
return this.editedOrder;
|
||||
}
|
||||
|
||||
const existingOrder = this.orders.find((o) => o.state === "draft");
|
||||
const existingOrder = this.orders.find(
|
||||
(o) =>
|
||||
o.state === "draft" ||
|
||||
(o.state === "paid" &&
|
||||
o.amount_total === 0 &&
|
||||
this.config.self_ordering_mode === "kiosk")
|
||||
);
|
||||
if (!existingOrder) {
|
||||
const newOrder = new Order({
|
||||
pos_config_id: this.pos_config_id,
|
||||
|
||||
Reference in New Issue
Block a user