summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-04-19 10:21:00 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2021-04-22 09:42:50 +0000
commit681eb75aeab02b9f904f85a3c60abd7c4a3c5269 (patch)
treec82f4da2fae0c41741bdac414ff7551286a0892d /addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js
parent08f152bb9ceb6bd4560aa177b392b0420162e131 (diff)
[FIX] point_of_sale: take into account fiscal position in order list
- Create Tax Exempt fiscal position - Create Customer with Tax Exempt in fiscal position - Enable Tax Exempt fiscal position in POS settings - In POS, set customer to one with Tax Exempt - Create a sale, apply, payment, validate, and click New Order - Click magnifying glass to reprint receipt - Default tax is automatically applied to all past orders/receipts This occur because: - in Pos OrderList the total is based on the amount total, and not the actual amount paid - the fiscal position object is not present when retrieving the order via `selectedOrder` opw-2485178 closes odoo/odoo#69475 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js')
-rw-r--r--addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js
index dcde9739f60..4ce88054e25 100644
--- a/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js
+++ b/addons/point_of_sale/static/src/js/Screens/OrderManagementScreen/OrderManagementScreen.js
@@ -13,7 +13,7 @@ odoo.define('point_of_sale.OrderManagementScreen', function (require) {
class OrderManagementScreen extends ControlButtonsMixin(IndependentToOrderScreen) {
constructor() {
super(...arguments);
- useListener('close-screen', this.close);
+ useListener('close-screen', this._close);
useListener('set-numpad-mode', this._setNumpadMode);
useListener('click-order', this._onClickOrder);
useListener('next-page', this._onNextPage);
@@ -78,6 +78,16 @@ odoo.define('point_of_sale.OrderManagementScreen', function (require) {
_onClickOrder({ detail: clickedOrder }) {
if (!clickedOrder || clickedOrder.locked) {
this.orderManagementContext.selectedOrder = clickedOrder;
+ let currentPOSOrder = this.env.pos.get_order();
+ if (clickedOrder.attributes.client){
+ currentPOSOrder.set_client(clickedOrder.attributes.client);
+ }
+ if (clickedOrder.fiscal_position){
+ currentPOSOrder.fiscal_position = clickedOrder.fiscal_position;
+ }
+ if (clickedOrder.pricelist){
+ currentPOSOrder.set_pricelist(clickedOrder.pricelist);
+ }
} else {
this._setOrder(clickedOrder);
}
@@ -91,6 +101,15 @@ odoo.define('point_of_sale.OrderManagementScreen', function (require) {
this.close();
}
}
+ _close() {
+ let currentOrder = this.env.pos.get_order();
+ if (currentOrder){
+ currentOrder.set_client(false);
+ currentOrder.fiscal_position = false;
+ currentOrder.set_pricelist(this.env.pos.default_pricelist);
+ }
+ this.close();
+ }
}
OrderManagementScreen.template = 'OrderManagementScreen';
OrderManagementScreen.hideOrderSelector = true;