mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
* fix: provision to enable do not use batch-wise valuation (#42186)
fix: provision to enable do not use batchwise valuation
(cherry picked from commit f06ba0cc36)
# Conflicts:
# erpnext/stock/doctype/stock_settings/stock_settings.json
* chore: fix conflicts
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -244,6 +244,8 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
|
||||
"Item", args.get("item_code"), ["has_serial_no", "has_batch_no"], as_dict=1
|
||||
)
|
||||
|
||||
use_moving_avg_for_batch = frappe.db.get_single_value("Stock Settings", "do_not_use_batchwise_valuation")
|
||||
|
||||
if isinstance(args, dict):
|
||||
args = frappe._dict(args)
|
||||
|
||||
@@ -257,7 +259,12 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
|
||||
|
||||
return sn_obj.get_incoming_rate()
|
||||
|
||||
elif item_details and item_details.has_batch_no and args.get("serial_and_batch_bundle"):
|
||||
elif (
|
||||
item_details
|
||||
and item_details.has_batch_no
|
||||
and args.get("serial_and_batch_bundle")
|
||||
and not use_moving_avg_for_batch
|
||||
):
|
||||
args.actual_qty = args.qty
|
||||
batch_obj = BatchNoValuation(
|
||||
sle=args,
|
||||
@@ -274,7 +281,7 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
|
||||
sn_obj = SerialNoValuation(sle=args, warehouse=args.get("warehouse"), item_code=args.get("item_code"))
|
||||
|
||||
return sn_obj.get_incoming_rate()
|
||||
elif args.get("batch_no") and not args.get("serial_and_batch_bundle"):
|
||||
elif args.get("batch_no") and not args.get("serial_and_batch_bundle") and not use_moving_avg_for_batch:
|
||||
args.actual_qty = args.qty
|
||||
args.batch_nos = frappe._dict({args.batch_no: args})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user