mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
[fix] Do not allow zero valuation rate for serial no and fetch previous valuation rate for serial no (#11817)
This commit is contained in:
committed by
Nabin Hait
parent
7a294e6ef5
commit
b1ac979ac5
@@ -230,6 +230,13 @@ class update_entries_after(object):
|
|||||||
# else it remains the same as that of previous entry
|
# else it remains the same as that of previous entry
|
||||||
self.valuation_rate = new_stock_value / new_stock_qty
|
self.valuation_rate = new_stock_value / new_stock_qty
|
||||||
|
|
||||||
|
if not self.valuation_rate and sle.voucher_detail_no:
|
||||||
|
allow_zero_rate = self.check_if_allow_zero_valuation_rate(sle.voucher_type, sle.voucher_detail_no)
|
||||||
|
if not allow_zero_rate:
|
||||||
|
self.valuation_rate = get_valuation_rate(sle.item_code, sle.warehouse,
|
||||||
|
sle.voucher_type, sle.voucher_no, self.allow_zero_rate,
|
||||||
|
currency=erpnext.get_company_currency(sle.company))
|
||||||
|
|
||||||
def get_moving_average_values(self, sle):
|
def get_moving_average_values(self, sle):
|
||||||
actual_qty = flt(sle.actual_qty)
|
actual_qty = flt(sle.actual_qty)
|
||||||
new_stock_qty = flt(self.qty_after_transaction) + actual_qty
|
new_stock_qty = flt(self.qty_after_transaction) + actual_qty
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ def get_incoming_rate(args):
|
|||||||
return 0.0
|
return 0.0
|
||||||
previous_stock_queue = json.loads(previous_sle.get('stock_queue', '[]') or '[]')
|
previous_stock_queue = json.loads(previous_sle.get('stock_queue', '[]') or '[]')
|
||||||
in_rate = get_fifo_rate(previous_stock_queue, args.get("qty") or 0) if previous_stock_queue else 0
|
in_rate = get_fifo_rate(previous_stock_queue, args.get("qty") or 0) if previous_stock_queue else 0
|
||||||
|
if not in_rate and not previous_stock_queue:
|
||||||
|
in_rate = previous_sle.get('valuation_rate') or 0
|
||||||
elif valuation_method == 'Moving Average':
|
elif valuation_method == 'Moving Average':
|
||||||
in_rate = previous_sle.get('valuation_rate') or 0
|
in_rate = previous_sle.get('valuation_rate') or 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user