fix: Check zero valuation rate only for valid doctypes (#18529)
fix: Check zero valuation rate only for valid doctypes
This commit is contained in:
commit
c6857e562b
@ -363,8 +363,17 @@ class update_entries_after(object):
|
|||||||
self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
|
self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
|
||||||
|
|
||||||
def check_if_allow_zero_valuation_rate(self, voucher_type, voucher_detail_no):
|
def check_if_allow_zero_valuation_rate(self, voucher_type, voucher_detail_no):
|
||||||
ref_item_dt = voucher_type + (" Detail" if voucher_type == "Stock Entry" else " Item")
|
ref_item_dt = ""
|
||||||
return frappe.db.get_value(ref_item_dt, voucher_detail_no, "allow_zero_valuation_rate")
|
|
||||||
|
if voucher_type == "Stock Entry":
|
||||||
|
ref_item_dt = voucher_type + " Detail"
|
||||||
|
elif voucher_type in ["Purchase Invoice", "Sales Invoice", "Delivery Note", "Purchase Receipt"]:
|
||||||
|
ref_item_dt = voucher_type + " Item"
|
||||||
|
|
||||||
|
if ref_item_dt:
|
||||||
|
return frappe.db.get_value(ref_item_dt, voucher_detail_no, "allow_zero_valuation_rate")
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def get_sle_before_datetime(self):
|
def get_sle_before_datetime(self):
|
||||||
"""get previous stock ledger entry before current time-bucket"""
|
"""get previous stock ledger entry before current time-bucket"""
|
||||||
|
Loading…
Reference in New Issue
Block a user