mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 21:29:11 +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>
16 lines
443 B
Python
16 lines
443 B
Python
import frappe
|
|
|
|
|
|
def execute():
|
|
valuation_method = frappe.db.get_single_value("Stock Settings", "valuation_method")
|
|
if valuation_method in ["FIFO", "LIFO"]:
|
|
return
|
|
|
|
if frappe.get_all("Batch", filters={"use_batchwise_valuation": 1}, limit=1):
|
|
return
|
|
|
|
if frappe.get_all("Item", filters={"has_batch_no": 1, "valuation_method": "FIFO"}, limit=1):
|
|
return
|
|
|
|
frappe.db.set_single_value("Stock Settings", "do_not_use_batchwise_valuation", 1)
|