You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
593 B

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