Exemple #1
0
def update_file_content(rendt):
	for d in rendt:
		print colored('Renaming... ' + d + ' --> '+ rendt[d], 'yellow')
		for extn in ['js', 'py', 'txt', 'html']:
			res = replace_code('/var/www/erpnext/', d, rendt[d], extn)
			if res == 'skip':
				break
Exemple #2
0
def replace_labels_with_fieldnames():
    """
		This is used for replacing instances like cur_frm.cscript['LABEL'] with
		cur_frm.cscript.FIELDNAME in js files
	"""
    doctype = {}
    doctype.update(
        prepare_dict_of_label_fieldname('/var/www/erpnext/erpnext/'))
    doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/lib/py'))
    #print doctype

    for doc in doctype:
        label_fieldname = doctype[doc]
        for d in label_fieldname:
            #label = "cur_frm.cscript['%s']" % d
            #fieldname = "cur_frm.cscript.%s" % label_fieldname[d]
            label = d
            fieldname = label_fieldname[d]
            print colored(
                'Changing... ' + doc + ': ' + label + ' --> ' + fieldname,
                'yellow')
            #res = replace_code('/var/www/erpnext/', label, fieldname, 'js')
            res = replace_code('/var/www/erpnext/', label, fieldname, 'js',
                               'hide_field\(.*%s' % label)
            if res == 'skip':
                break
Exemple #3
0
def replace_labels_with_fieldnames():
	"""
		This is used for replacing instances like cur_frm.cscript['LABEL'] with
		cur_frm.cscript.FIELDNAME in js files
	"""
	doctype = {}
	doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/erpnext/'))
	doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/lib/py'))
	#print doctype
	
	for doc in doctype:
		label_fieldname = doctype[doc]
		for d in label_fieldname:
			#label = "cur_frm.cscript['%s']" % d
			#fieldname = "cur_frm.cscript.%s" % label_fieldname[d]
			label = d
			fieldname = label_fieldname[d]
			print colored('Changing... ' + doc + ': ' + label + ' --> '+ fieldname, 'yellow')
			#res = replace_code('/var/www/erpnext/', label, fieldname, 'js')
			res = replace_code('/var/www/erpnext/', label, fieldname, 'js',
					'hide_field\(.*%s' % label)
			if res == 'skip':
				break