From 04441969b4e4ffe4500554e2214da7209fc9290a Mon Sep 17 00:00:00 2001 From: MerlinGuillaume Date: Thu, 16 Jun 2022 12:42:25 +0000 Subject: [PATCH] [FIX] pos_sale: hide sale orders that are not in POS currency Sale orders' amount in POS are displayed in the POS currency but they can be in another currency making it possible to settle the wrong amount Steps to reproduce: 1. Install Point of Sale and Sales 2. Go to Settings > Invoicing > Currencies and activate another currency (e.g. EUR) 3. Go to Settings > Sales > Pricing > Pricelists and create a new pricelist for the new currency 4. Create a new Sale Order with the EUR pricelist and any product and confirm it (do not invoice) 5. Open a new session in the POS Shop 6. Go to Quotation/Order 7. The new SO is displayed with the amount in EUR but the currency symbol is USD Solution: Add a filter on the POS currency to the domain of the rpc call search_read on sale orders Problem: The field `amount_total` is used to display the price but this field can be in any currency opw-2865371 closes odoo/odoo#94710 X-original-commit: 0ebe29c794813a0854c7a6f433088a919a52cbbc Signed-off-by: Guillaume Merlin (megu) --- .../static/src/js/OrderManagementScreen/SaleOrderFetcher.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/pos_sale/static/src/js/OrderManagementScreen/SaleOrderFetcher.js b/addons/pos_sale/static/src/js/OrderManagementScreen/SaleOrderFetcher.js index f6f4ef145aa..65a55fdd7c6 100644 --- a/addons/pos_sale/static/src/js/OrderManagementScreen/SaleOrderFetcher.js +++ b/addons/pos_sale/static/src/js/OrderManagementScreen/SaleOrderFetcher.js @@ -78,10 +78,11 @@ odoo.define('pos_sale.SaleOrderFetcher', function (require) { return sale_orders; } async _getOrderIdsForCurrentPage(limit, offset) { + let domain = [['currency_id', '=', this.comp.env.pos.currency.id]].concat(this.searchDomain || []); return await this.rpc({ model: 'sale.order', method: 'search_read', - args: [this.searchDomain ? this.searchDomain : [], ['name', 'partner_id', 'amount_total', 'date_order', 'state', 'user_id'], offset, limit], + args: [domain, ['name', 'partner_id', 'amount_total', 'date_order', 'state', 'user_id'], offset, limit], context: this.comp.env.session.user_context, }); }