[FIX] pos_restaurant: avoid printing empty receipts when tip after payment is active

Steps to reproduce:
- Install POS app.
- Go to POS settings and enable:
    - Is a Bar/Restaurant
    - Tips > Add tip after payment
- Open a POS session -if first time, add a floor and a table-
- Add a product
- Click on payment
- Choose a payment method
- Click on Close Tab
- The print popup is shown twice in a row with an empty subtotal amount.

Investigation:
- Inside the `TipReceipt` template, the `total` is not shown as the class lacks a getter for it [1]
- Also when there is no printer, we won't fallback to the web printer as it's annoying to the cashier.

[1]: https://github.com/odoo/odoo/blob/1d49034782e3ff0e4384bad4e927a895e2a97839/addons/pos_restaurant/static/src/app/tip_receipt/tip_receipt.xml#L13-L16

opw-3836549

closes odoo/odoo#161056

Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
This commit is contained in:
AH-Yussef
2024-04-24 14:48:56 +00:00
parent 35c34415a1
commit 3aa2d05213
2 changed files with 5 additions and 1 deletions
@@ -7,4 +7,8 @@ export class TipReceipt extends Component {
static template = "pos_restaurant.TipReceipt";
static components = { ReceiptHeader };
static props = ["headerData", "data", "total"];
get total() {
return this.props.total;
}
}
@@ -123,7 +123,7 @@ export class TipScreen extends Component {
data: receipts[i],
total: this.env.utils.formatCurrency(this.totalAmount),
},
{ webPrintFallback: true }
{ webPrintFallback: false }
);
}
}