Impacted versions: v11 and v12
Steps to reproduce:
Install sale_management, stock, account_accountant and purchase. Enable "Lots & Serial Numbers" from Inventory/Configuration/Setting. Create a product tracking with lot then change the 'Costing Method' field on the category to 'FIFO' and change the 'Inventory Valuation' filed on the category to 'Automated'. Create a purchase order with the above product with unit price equal to 10 then receive the product with "lot-1" as lot name. Duplicate the above purchase order, change the unit price to 3 then receive the product with "lot-2" as lot name. Create a sale order with qty = 1 from for the above product and deliver from "lot-2". Reviewing the stock valuation entry created from the delivery order above, the value of journal entry is 10.
Expected behavior: Value of the stock valuation entry should be 3 as we have delivered from “lot-2”.