Ejemplo n.º 1
0
def _bulk_rename(context, doctype, path):
	"Rename multiple records via CSV file"
	from frappe.model.rename_doc import bulk_rename
	from frappe.utils.csvutils import read_csv_content

	site = get_site(context)

	with open(path, 'r') as csvfile:
		rows = read_csv_content(csvfile.read())

	frappe.init(site=site)
	frappe.connect()

	bulk_rename(doctype, rows, via_console = True)

	frappe.destroy()
Ejemplo n.º 2
0
def _bulk_rename(context, doctype, path):
	"Rename multiple records via CSV file"
	from frappe.model.rename_doc import bulk_rename
	from frappe.utils.csvutils import read_csv_content

	site = get_single_site(context)

	with open(path, 'r') as csvfile:
		rows = read_csv_content(csvfile.read())

	frappe.init(site=site)
	frappe.connect()

	bulk_rename(doctype, rows, via_console = True)

	frappe.destroy()
Ejemplo n.º 3
0
def _bulk_rename(context, doctype, path):
    "Import CSV using data import tool"
    from frappe.model.rename_doc import bulk_rename
    from frappe.utils.csvutils import read_csv_content

    site = get_single_site(context)

    with open(path, 'r') as csvfile:
        rows = read_csv_content(csvfile.read())

    frappe.init(site=site)
    frappe.connect()

    bulk_rename(doctype, rows, via_console=True)

    frappe.destroy()
Ejemplo n.º 4
0
def upload(select_doctype=None, rows=None):
	from frappe.utils.csvutils import read_csv_content_from_attached_file
	if not select_doctype:
		select_doctype = frappe.form_dict.select_doctype

	if not frappe.has_permission(select_doctype, "write"):
		raise frappe.PermissionError

	rows = read_csv_content_from_attached_file(frappe.get_doc("Rename Tool", "Rename Tool"))

	return bulk_rename(select_doctype, rows=rows)
Ejemplo n.º 5
0
def upload(select_doctype=None, rows=None):
    from frappe.utils.csvutils import read_csv_content_from_attached_file
    if not select_doctype:
        select_doctype = frappe.form_dict.select_doctype

    if not frappe.has_permission(select_doctype, "write"):
        raise frappe.PermissionError

    rows = read_csv_content_from_attached_file(
        frappe.get_doc("Rename Tool", "Rename Tool"))

    return bulk_rename(select_doctype, rows=rows)