|
- # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
- # MIT License. See license.txt
-
- from __future__ import unicode_literals
- import frappe
-
- def execute():
- attach_fields = (frappe.db.sql("""select parent, fieldname from `tabDocField` where fieldtype='Attach'""") +
- frappe.db.sql("""select dt, fieldname from `tabCustom Field` where fieldtype='Attach'"""))
-
- for doctype, fieldname in attach_fields:
- frappe.db.sql("""update `tab{doctype}` set `{fieldname}`=concat("/", `{fieldname}`)
- where `{fieldname}` like 'files/%'""".format(doctype=doctype, fieldname=fieldname))
|