Merge pull request #4258 from anandpdoshi/fixes-3to6
[fix] issues encountered migrating from v3/4 to 6
diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py
index 9edac2e..41fd8b2 100644
--- a/erpnext/controllers/recurring_document.py
+++ b/erpnext/controllers/recurring_document.py
@@ -163,7 +163,7 @@
raise_exception=1)
elif not (doc.from_date and doc.to_date):
- throw(_("Period From and Period To dates mandatory for recurring %s") % doc.doctype)
+ throw(_("Period From and Period To dates mandatory for recurring {0}").format(doc.doctype))
#
def convert_to_recurring(doc, posting_date):
diff --git a/erpnext/patches/v4_4/make_email_accounts.py b/erpnext/patches/v4_4/make_email_accounts.py
index e495bcd..1acd8de 100644
--- a/erpnext/patches/v4_4/make_email_accounts.py
+++ b/erpnext/patches/v4_4/make_email_accounts.py
@@ -9,7 +9,9 @@
if outgoing and outgoing['mail_server'] and outgoing['mail_login']:
account = frappe.new_doc("Email Account")
mapping = {
- "email_id": "mail_login",
+ "login_id_is_different": 1,
+ "email_id": "auto_email_id",
+ "login_id": "mail_login",
"password": "mail_password",
"footer": "footer",
"smtp_server": "mail_server",
diff --git a/erpnext/patches/v5_0/update_projects.py b/erpnext/patches/v5_0/update_projects.py
index 6214927..68e03c9 100644
--- a/erpnext/patches/v5_0/update_projects.py
+++ b/erpnext/patches/v5_0/update_projects.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
import frappe
def execute():
@@ -11,9 +13,12 @@
for m in frappe.get_all("Project Milestone", "*"):
if (m.milestone and m.milestone_date
and frappe.db.exists("Project", m.parent)):
+ subject = (m.milestone[:139] + "…") if (len(m.milestone) > 140) else m.milestone
+ description = m.milestone
task = frappe.get_doc({
"doctype": "Task",
- "subject": m.milestone,
+ "subject": subject,
+ "description": description if description!=subject else None,
"expected_start_date": m.milestone_date,
"status": "Open" if m.status=="Pending" else "Closed",
"project": m.parent,
diff --git a/erpnext/patches/v5_4/fix_missing_item_images.py b/erpnext/patches/v5_4/fix_missing_item_images.py
index 1dffc21..1891d2d 100644
--- a/erpnext/patches/v5_4/fix_missing_item_images.py
+++ b/erpnext/patches/v5_4/fix_missing_item_images.py
@@ -40,7 +40,17 @@
file_data = frappe.get_doc("File", unlinked_files[file_url]["file"])
file_data.attached_to_doctype = "Item"
file_data.attached_to_name = item_code
- file_data.save()
+ file_data.flags.ignore_folder_validate = True
+
+ try:
+ file_data.save()
+ except IOError:
+ print "File {0} does not exist".format(new_file_url)
+
+ # marking fix to prevent further errors
+ fixed_files.append(file_url)
+
+ continue
# set it as image in Item
if not frappe.db.get_value("Item", item_code, "image"):
diff --git a/erpnext/patches/v6_0/set_default_title.py b/erpnext/patches/v6_0/set_default_title.py
index e72e5c0..83b6b59 100644
--- a/erpnext/patches/v6_0/set_default_title.py
+++ b/erpnext/patches/v6_0/set_default_title.py
@@ -30,3 +30,6 @@
frappe.reload_doctype("Sales Invoice")
frappe.db.sql("""update `tabSales Invoice` set title = customer_name""")
+
+ frappe.reload_doctype("Expense Claim")
+ frappe.db.sql("""update `tabExpense Claim` set title = employee_name""")