From e32de8e49d23cf2b328893245bd854827d97e3ea Mon Sep 17 00:00:00 2001 From: Cas Vissers Date: Sun, 2 Feb 2020 09:43:09 +0100 Subject: [PATCH] [FIX] Standard price incorrectly calculated on historic value --- .../reports/stock_inventory_valuation_report.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py index 26caecf..e4c4e08 100644 --- a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py @@ -53,14 +53,19 @@ class StockInventoryValuationReport(models.TransientModel): create=False, edit=False)) ReportLine = self.env['stock.inventory.valuation.view'] for product in products: + standard_price = product.standard_price + if self.date: + standard_price = product.get_history_price( + self.env.user.company_id.id, + date=self.date) line = { 'display_name': product.display_name, 'qty_at_date': product.qty_at_date, 'uom_id': product.uom_id, 'currency_id': product.currency_id, 'cost_currency_id': product.cost_currency_id, - 'standard_price': product.standard_price, - 'stock_value': product.stock_value, + 'standard_price': standard_price, + 'stock_value': product.qty_at_date * standard_price, 'cost_method': product.cost_method, } if product.qty_at_date != 0: