diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 055b09c2d31..4e726333a7f 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -670,7 +670,8 @@ class BuyingController(SubcontractingController): "actual_qty": flt( flt(d.rejected_qty) * flt(d.conversion_factor), d.precision("stock_qty") ), - "incoming_rate": valuation_rate_for_rejected_item, + "incoming_rate": valuation_rate_for_rejected_item if not self.is_return else 0.0, + "outgoing_rate": valuation_rate_for_rejected_item if self.is_return else 0.0, "serial_and_batch_bundle": d.rejected_serial_and_batch_bundle, }, ) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 903a216d9db..c8c81c2a124 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -499,9 +499,7 @@ class PurchaseReceipt(BuyingController): if item.get("rejected_qty") and frappe.db.get_single_value( "Buying Settings", "set_valuation_rate_for_rejected_materials" ): - outgoing_amount += abs( - get_stock_value_difference(self.name, item.name, item.rejected_warehouse) - ) + outgoing_amount += get_stock_value_difference(self.name, item.name, item.rejected_warehouse) credit_amount = outgoing_amount if credit_amount: @@ -640,9 +638,7 @@ class PurchaseReceipt(BuyingController): if item.get("rejected_qty") and frappe.db.get_single_value( "Buying Settings", "set_valuation_rate_for_rejected_materials" ): - rejected_item_cost = abs( - get_stock_value_difference(self.name, item.name, item.rejected_warehouse) - ) + rejected_item_cost = get_stock_value_difference(self.name, item.name, item.rejected_warehouse) divisional_loss -= rejected_item_cost if divisional_loss: