mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 09:05:00 +00:00
change from labels to fieldname in cur_frm.cscript
This commit is contained in:
7
wnf.py
7
wnf.py
@@ -18,9 +18,12 @@
|
||||
|
||||
import os, sys
|
||||
|
||||
def replace_code(start, txt1, txt2, extn):
|
||||
def replace_code(start, txt1, txt2, extn, search=None):
|
||||
"""replace all txt1 by txt2 in files with extension (extn)"""
|
||||
import webnotes.utils
|
||||
import os, re
|
||||
esc = webnotes.utils.make_esc('[]')
|
||||
if not search: search = esc(txt1)
|
||||
for wt in os.walk(start, followlinks=1):
|
||||
for fn in wt[2]:
|
||||
if fn.split('.')[-1]==extn:
|
||||
@@ -29,7 +32,7 @@ def replace_code(start, txt1, txt2, extn):
|
||||
with open(fpath, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if re.search(txt1, content):
|
||||
if re.search(search, content):
|
||||
res = search_replace_with_prompt(fpath, txt1, txt2)
|
||||
if res == 'skip':
|
||||
return 'skip'
|
||||
|
||||
Reference in New Issue
Block a user