mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
fixes in stock reco, test case for serial no stock entry
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
rename_fields()
|
||||
|
||||
def rename_fields():
|
||||
webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
|
||||
|
||||
args = [["Stock Ledger Entry", "bin_aqat", "qty_after_transaction"],
|
||||
["Stock Ledger Entry", "fcfs_stack", "stock_queue"]]
|
||||
for doctype, old_fieldname, new_fieldname in args:
|
||||
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" %
|
||||
(doctype, new_fieldname, old_fieldname))
|
||||
|
||||
35
patches/january_2013/stock_reconciliation_patch.py
Normal file
35
patches/january_2013/stock_reconciliation_patch.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
|
||||
|
||||
rename_fields()
|
||||
store_stock_reco_json()
|
||||
|
||||
def rename_fields():
|
||||
args = [["Stock Ledger Entry", "bin_aqat", "qty_after_transaction"],
|
||||
["Stock Ledger Entry", "fcfs_stack", "stock_queue"]]
|
||||
for doctype, old_fieldname, new_fieldname in args:
|
||||
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" %
|
||||
(doctype, new_fieldname, old_fieldname))
|
||||
|
||||
def store_stock_reco_json():
|
||||
import os
|
||||
import conf
|
||||
import json
|
||||
from webnotes.utils.datautils import read_csv_content
|
||||
base_path = os.path.dirname(os.path.abspath(conf.__file__))
|
||||
|
||||
for reco, file_list in webnotes.conn.sql("""select name, file_list
|
||||
from `tabStock Reconciliation`"""):
|
||||
if file_list:
|
||||
file_list = file_list.split("\n")
|
||||
stock_reco_file = file_list[0].split(",")[1]
|
||||
stock_reco_file = os.path.join(base_path, "public", "files", stock_reco_file)
|
||||
if os.path.exists(stock_reco_file):
|
||||
with open(stock_reco_file, "r") as open_reco_file:
|
||||
content = open_reco_file.read()
|
||||
content = read_csv_content(content)
|
||||
webnotes.conn.set_value("Stock Reconciliation", reco, "reconciliation_json",
|
||||
json.dumps(content, separators=(',', ': ')))
|
||||
|
||||
Reference in New Issue
Block a user