mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 05:29:18 +00:00
fix: incoming rate for the stand-alone credit note
(cherry picked from commit b06eca8dcb)
# Conflicts:
# erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
This commit is contained in:
committed by
Mergify
parent
78013d3d8f
commit
ad40bfe4ea
@@ -680,6 +680,14 @@ def get_rate_for_return(
|
||||
raise_error_if_no_rate=False,
|
||||
)
|
||||
|
||||
if not rate and voucher_type in ["Sales Invoice", "Delivery Note"]:
|
||||
details = frappe.db.get_value(
|
||||
voucher_type + " Item", voucher_detail_no, ["rate", "allow_zero_valuation_rate"], as_dict=1
|
||||
)
|
||||
|
||||
if details and not details.allow_zero_valuation_rate:
|
||||
rate = flt(details.rate)
|
||||
|
||||
return rate
|
||||
|
||||
|
||||
|
||||
@@ -525,6 +525,15 @@ class SellingController(StockController):
|
||||
self.doctype, self.name, d.item_code, self.return_against, item_row=d
|
||||
)
|
||||
|
||||
if (
|
||||
self.get("is_return")
|
||||
and not d.incoming_rate
|
||||
and not self.get("return_against")
|
||||
and not self.is_internal_transfer()
|
||||
and not d.get("allow_zero_valuation_rate")
|
||||
):
|
||||
d.incoming_rate = d.rate
|
||||
|
||||
# For internal transfers use incoming rate as the valuation rate
|
||||
if self.is_internal_transfer():
|
||||
if self.doctype == "Delivery Note" or self.get("update_stock"):
|
||||
|
||||
Reference in New Issue
Block a user