feat: allow to set valuation rate for Rejected Materials (backport #47582) (#47869)

feat: allow to set valuation rate for Rejected Materials (#47582)

(cherry picked from commit ca0e53dd78)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2025-06-03 16:25:53 +05:30
committed by GitHub
parent 2815a0d827
commit 3582b32f03
5 changed files with 190 additions and 12 deletions

View File

@@ -658,6 +658,10 @@ class BuyingController(SubcontractingController):
sl_entries.append(from_warehouse_sle)
if flt(d.rejected_qty) != 0:
valuation_rate_for_rejected_item = 0.0
if frappe.db.get_single_value("Buying Settings", "set_valuation_rate_for_rejected_materials"):
valuation_rate_for_rejected_item = d.valuation_rate
sl_entries.append(
self.get_sl_entries(
d,
@@ -666,7 +670,7 @@ class BuyingController(SubcontractingController):
"actual_qty": flt(
flt(d.rejected_qty) * flt(d.conversion_factor), d.precision("stock_qty")
),
"incoming_rate": 0.0,
"incoming_rate": valuation_rate_for_rejected_item,
"serial_and_batch_bundle": d.rejected_serial_and_batch_bundle,
},
)