diff --git a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js index b6236e36f38..ef4c79b63ea 100644 --- a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js +++ b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js @@ -274,6 +274,20 @@ export class TicketScreen extends Component { return; } + const invoicedOrderIds = new Set( + allToRefundDetails + .filter(detail => this._state.syncedOrders.cache[detail.orderline.orderBackendId].state === "invoiced") + .map(detail => detail.orderline.orderBackendId) + ); + + if (invoicedOrderIds.size > 1) { + this.popup.add(ErrorPopup, { + title: _t('Multiple Invoiced Orders Selected'), + body: _t('You have selected orderlines from multiple invoiced orders. To proceed refund, please select orderlines from the same invoiced order.') + }); + return; + } + // The order that will contain the refund orderlines. // Use the destinationOrder from props if the order to refund has the same // partner as the destinationOrder. @@ -391,7 +405,7 @@ export class TicketScreen extends Component { } getStatus(order) { if (order.locked) { - return _t("Paid"); + return order.state === 'invoiced' ? _t('Invoiced') : _t("Paid"); } else { const screen = order.get_screen_data(); return this._getOrderStates().get(this._getScreenToStatusMap()[screen.name]).text;