From 292971cb6c36ffa774292cd4363e17977cf73b8e Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 16 Dec 2019 14:49:52 +0000 Subject: [PATCH] [FIX] stock_account: valuation multi-currency - Set USD as company currency - Set the EUR rate to 1.5 - Create a product A: FIFO & automated, invoicing based on delivery - Create a pricelist in EUR - Buy some quantity @ 100 USD - Create a SO for 1 @ 200 EUR - Confirm the SO, validate the picking, generate the invoice - Post the invoice The COGS are incorrect: Amount Currency Debit Credit Stock Interim (Delivered) -66.67 0.00 100.00 Expense 66.67 100.00 0.00 It should be: Amount Currency Debit Credit Stock Interim (Delivered) 0.00 0.00 100.00 Expense 0.00 100.00 0.00 opw-2148171 closes odoo/odoo#42381 X-original-commit: 3a6ada5e550775e84c3d8a2f720bdd45250e2880 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock_account/models/account_move.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/addons/stock_account/models/account_move.py b/addons/stock_account/models/account_move.py index 36f7de46eba..8766f747861 100644 --- a/addons/stock_account/models/account_move.py +++ b/addons/stock_account/models/account_move.py @@ -109,14 +109,6 @@ class AccountMove(models.Model): sign = -1 if move.type == 'out_refund' else 1 price_unit = line._stock_account_get_anglo_saxon_price_unit() balance = sign * line.quantity * price_unit - if move.currency_id == move.company_id.currency_id: - currency = False - amount_currency = 0.0 - else: - currency = move.currency_id - price_unit = currency._convert( - price_unit, move.company_id.currency_id, move.company_id, move.invoice_date or move.date) - amount_currency = sign * line.quantity * price_unit # Add interim account line. lines_vals_list.append({ @@ -126,11 +118,8 @@ class AccountMove(models.Model): 'product_uom_id': line.product_uom_id.id, 'quantity': line.quantity, 'price_unit': price_unit, - 'price_subtotal': amount_currency if currency else balance, 'debit': balance < 0.0 and -balance or 0.0, 'credit': balance > 0.0 and balance or 0.0, - 'currency_id': currency and currency.id, - 'amount_currency': -amount_currency, 'account_id': debit_interim_account.id, 'analytic_account_id': line.analytic_account_id.id, 'analytic_tag_ids': [(6, 0, line.analytic_tag_ids.ids)], @@ -146,11 +135,8 @@ class AccountMove(models.Model): 'product_uom_id': line.product_uom_id.id, 'quantity': line.quantity, 'price_unit': -price_unit, - 'price_subtotal': -amount_currency if currency else -balance, 'debit': balance > 0.0 and balance or 0.0, 'credit': balance < 0.0 and -balance or 0.0, - 'currency_id': currency and currency.id, - 'amount_currency': amount_currency, 'account_id': credit_expense_account.id, 'analytic_account_id': line.analytic_account_id.id, 'analytic_tag_ids': [(6, 0, line.analytic_tag_ids.ids)],