From aba8fdd18d9285e149b18b3579dd336952f00f6a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Sat, 31 Oct 2015 22:49:42 +0530 Subject: [PATCH] [fix] issues encountered migrating from v3/4 to 6 --- erpnext/controllers/recurring_document.py | 2 +- erpnext/patches/v4_4/make_email_accounts.py | 4 +++- erpnext/patches/v5_0/update_projects.py | 7 ++++++- erpnext/patches/v5_4/fix_missing_item_images.py | 12 +++++++++++- erpnext/patches/v6_0/set_default_title.py | 3 +++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py index 9edac2e803..41fd8b27b5 100644 --- a/erpnext/controllers/recurring_document.py +++ b/erpnext/controllers/recurring_document.py @@ -163,7 +163,7 @@ def validate_recurring_document(doc): 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 e495bcd0b0..1acd8de68c 100644 --- a/erpnext/patches/v4_4/make_email_accounts.py +++ b/erpnext/patches/v4_4/make_email_accounts.py @@ -9,7 +9,9 @@ def execute(): 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 6214927654..68e03c9bdb 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 @@ def execute(): 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 1dffc216cf..1891d2d622 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 @@ def fix_files_for_item(files_path, unlinked_files): 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 e72e5c0f8b..83b6b59897 100644 --- a/erpnext/patches/v6_0/set_default_title.py +++ b/erpnext/patches/v6_0/set_default_title.py @@ -30,3 +30,6 @@ def execute(): 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""")