Hi All,
Precondition : Purchase UoM = 4 * Product UoM and Purchase Currency (amount currency) and Company Currency is different
I think below code is having a bug. We issued PO for 100 units of Product with 10 USD (with purchase UoM), so amount_currency in Journey Entry must be 100 x10 = 1000 USD but Since Product UoM is different from purchase UoM, in Good Receipt, we have 400 Units of Product Received which is correct. But Below code calculated with (DO quantity * Unit Price) for amount_currency instead of (PO quantity * Unit Price).
/odoo/addons/purchase_stock/models/stock.py
def _generate_valuation_lines_data(self, partner_id, qty, debit_value, credit_value, debit_account_id, credit_account_id): """ Overridden from stock_account to support amount_currency on valuation lines generated from po """ self.ensure_one() rslt = super(StockMove, self)._generate_valuation_lines_data(partner_id, qty, debit_value, credit_value, debit_account_id, credit_account_id) if self.purchase_line_id: purchase_currency = self.purchase_line_id.currency_id if purchase_currency != self.company_id.currency_id: purchase_price_unit = self.purchase_line_id.price_unit currency_move_valuation = purchase_currency.round(purchase_price_unit * abs(qty)) rslt['credit_line_vals']['amount_currency'] = rslt['credit_line_vals']['credit'] and -currency_move_valuation or currency_move_valuation rslt['credit_line_vals']['currency_id'] = purchase_currency.id rslt['debit_line_vals']['amount_currency'] = rslt['debit_line_vals']['credit'] and -currency_move_valuation or currency_move_valuation rslt['debit_line_vals']['currency_id'] = purchase_currency.id return rslt
latest code for https://github.com/odoo/odoo/blob/12.0/addons/purchase_stock/models/stock.py already fixed above issue, Thanks all.