From 0744aaf6f75cbd748507108fc35f95fb275d0840 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Thu, 23 Sep 2021 10:26:44 +0000 Subject: [PATCH] [FIX] point_of_sale: cogs entries wrong currency conversion 1) Have Accounting and POS. 2) Activate multi-currencies (EUR and USD available). 3) Main currency should be USD, set a rate to EUR (i.e. 0.5). 4) Activate automated inventory valuation [CATEG]. 5) Create storable product [TEST]: - Storable, Category [CATEG] - with public price $10 and cost $1 - available in POS - no taxes needed 6) Have a POS in EUR (Pricelists, Journal, Payment methods + their journal in EUR). 7) Sell [TEST] (it costs ($10/2) = 5EUR) 8) Close the session and post entries. Result: in the journal Items, some of the COGS entries (110300 Stock Interim (Delivered) and 600000 Expenses) are multiplied by the ratio between $ and EUR. This occur because the system attempts to convert an amount which has been created in company currency. opw-2613739 closes odoo/odoo#78227 X-original-commit: 91d6a81fef551a03e6af94c356b7e943ef53c473 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: agr-odoo --- addons/point_of_sale/models/pos_session.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index aee127731a6..bcb1783d7b9 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -793,11 +793,11 @@ class PosSession(models.Model): exp_key = move.product_id._get_product_accounts()['expense'] out_key = move.product_id.categ_id.property_stock_account_output_categ_id amount = -sum(move.stock_valuation_layer_ids.mapped('value')) - stock_expense[exp_key] = self._update_amounts(stock_expense[exp_key], {'amount': amount}, move.picking_id.date) + stock_expense[exp_key] = self._update_amounts(stock_expense[exp_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) if move.location_id.usage == 'customer': - stock_return[out_key] = self._update_amounts(stock_return[out_key], {'amount': amount}, move.picking_id.date) + stock_return[out_key] = self._update_amounts(stock_return[out_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) else: - stock_output[out_key] = self._update_amounts(stock_output[out_key], {'amount': amount}, move.picking_id.date) + stock_output[out_key] = self._update_amounts(stock_output[out_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) MoveLine = self.env['account.move.line'].with_context(check_move_validity=False) data.update({