patch for is_batch_item
This commit is contained in:
parent
4e803af0e6
commit
f0b0464cce
@ -92,3 +92,4 @@ execute:frappe.delete_doc("DocType", "Contact Control")
|
||||
erpnext.patches.v4_2.recalculate_bom_costs
|
||||
erpnext.patches.v4_2.discount_amount
|
||||
erpnext.patches.v4_2.update_landed_cost_voucher
|
||||
erpnext.patches.v4_2.set_item_batch
|
||||
|
20
erpnext/patches/v4_2/set_item_batch.py
Normal file
20
erpnext/patches/v4_2/set_item_batch.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
item_list = frappe.db.sql("""select name from tabItem""", as_dict=1)
|
||||
for d in item_list:
|
||||
count_stock_entries = frappe.db.sql("""select count(name) from `tabStock Entry Detail` where item_code= %s""",d.get("name"))[0][0]
|
||||
|
||||
count_batch_entries = frappe.db.sql("""select count(name) from `tabStock Entry Detail` where \
|
||||
item_code= %s and batch_no = '' """,d.get("name"))[0][0]
|
||||
|
||||
if count_stock_entries > 0:
|
||||
if count_stock_entries == count_batch_entries:
|
||||
frappe.db.sql("""update `tabItem` set has_batch_no = 'Yes' where name = %s""",d.get("name"))
|
||||
|
||||
if count_batch_entries == 0:
|
||||
frappe.db.sql("""update `tabItem` set has_batch_no = 'No' where name = %s""",d.get("name"))
|
Loading…
Reference in New Issue
Block a user