From 16b8ecbe058bfb406cc35ddfe9c7bef69626c9fb Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 30 Nov 2018 16:20:52 +0530 Subject: [PATCH] [Fix] Stock value difference calculation for stock reconciliation --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 2 +- erpnext/stock/stock_ledger.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 5b6e706674..257434fb89 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -180,7 +180,7 @@ class StockReconciliation(StockController): frappe.throw(_("Valuation Rate required for Item in row {0}").format(row.idx)) if ((previous_sle and row.qty == previous_sle.get("qty_after_transaction") - and row.valuation_rate == previous_sle.get("valuation_rate")) + and (row.valuation_rate == previous_sle.get("valuation_rate") or row.qty == 0)) or (not previous_sle and not row.qty)): continue diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 43140faff6..c73cbf2942 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -176,7 +176,7 @@ class update_entries_after(object): # rounding as per precision self.stock_value = flt(self.stock_value, self.precision) - if self.prev_stock_value < 0 and self.stock_value >= 0: + if self.prev_stock_value < 0 and self.stock_value >= 0 and sle.voucher_type != 'Stock Reconciliation': stock_value_difference = sle.actual_qty * self.valuation_rate else: stock_value_difference = self.stock_value - self.prev_stock_value