Files
schuetz3-erpnext/erpnext/patches/v15_0/do_not_use_batchwise_valuation.py
rohitwaghchaure f06ba0cc36 fix: provision to enable do not use batch-wise valuation (#42186)
fix: provision to enable do not use batchwise valuation
2024-07-05 20:14:32 +05:30

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)