From 78c7f03731a35bdc06b9fa414aa8efeebfd76fc2 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 30 Sep 2019 15:18:38 +0530 Subject: [PATCH] fix: mismatch stock value between stock balance report and stock in hand in trial balance (#19203) --- erpnext/controllers/buying_controller.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 73b158d14be..158e87e9edf 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -515,10 +515,15 @@ class BuyingController(StockController): for d in self.get('supplied_items'): # negative quantity is passed, as raw material qty has to be decreased # when PR is submitted and it has to be increased when PR is cancelled + incoming_rate = 0 + if self.is_return and self.return_against and self.docstatus==1: + incoming_rate = self.get_incoming_rate_for_sales_return(d.rm_item_code, self.return_against) + sl_entries.append(self.get_sl_entries(d, { "item_code": d.rm_item_code, "warehouse": self.supplier_warehouse, "actual_qty": -1*flt(d.consumed_qty), + "incoming_rate": incoming_rate })) def on_submit(self):