diff --git a/frappe/__init__.py b/frappe/__init__.py index 8b69d32f93..237f084f24 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -17,7 +17,13 @@ from faker import Faker from .exceptions import * from .utils.jinja import (get_jenv, get_template, render_template, get_email_from_template, get_jloader) -__version__ = '10.1.70' +# Hamless for Python 3 +# For Python 2 set default encoding to utf-8 +if sys.version[0] == '2': + reload(sys) + sys.setdefaultencoding("utf-8") + +__version__ = '10.1.71' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/change_log/v11/v11_1_0.md b/frappe/change_log/v11/v11_1_0.md new file mode 100644 index 0000000000..12a214c458 --- /dev/null +++ b/frappe/change_log/v11/v11_1_0.md @@ -0,0 +1,19 @@ +- Dynamic [Frappe Charts](https://github.com/frappe/charts) with Report Builder (built by @pratu16x7) +- New Frappe Chat for easier internal communication (built by @achillesrasquinha) +- [Frappe DataTable](https://github.com/frappe/datatable) for better reports (built by @netchampfaris) +- Google Calendar can now be integrated with Frappe +- Files can now be uploaded using drag-and-drop +- Enhanced List View and Tree View +- Bulk Actions from List View +- Quill editor has been introduced in place of Summernote +- HTML Editor has been introduced +- New User Permissions +- Subscriptions in ERPNext now moved to Auto Repeat in Frappe +- Support for Razorpay and PayPal subscriptions +- Better Social login, Workflow +- Messages for when user goes online/offline +- Logout from all sessions on password change +- Desktop icons can now be selected from a dialog box +- Changes have been made to ensure Frappe is compatible with Python 3 +- Better documentation is now available with support for more languages +- A lot of other fixes have been done to ensure a better overall user experience \ No newline at end of file diff --git a/frappe/change_log/v8/v8_7_0.md b/frappe/change_log/v8/v8_7_0.md index c7b0b4d577..8c982dcbcc 100644 --- a/frappe/change_log/v8/v8_7_0.md +++ b/frappe/change_log/v8/v8_7_0.md @@ -1,2 +1,2 @@ ### User Permissions -- User Permission is now a DocType, a new UX for the existing Role and User Permission managers to make it easy to enter permissions. For more details please check User Permissions \ No newline at end of file +- User Permission is now a DocType, a new UX for the existing Role and User Permission managers to make it easy to enter permissions. For more details please check User Permissions \ No newline at end of file diff --git a/frappe/chat/__init__.py b/frappe/chat/__init__.py index a1a2e9cb36..dea0030839 100644 --- a/frappe/chat/__init__.py +++ b/frappe/chat/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe import _ diff --git a/frappe/chat/doctype/chat_message/chat_message.py b/frappe/chat/doctype/chat_message/chat_message.py index 06127b3148..657009b2c1 100644 --- a/frappe/chat/doctype/chat_message/chat_message.py +++ b/frappe/chat/doctype/chat_message/chat_message.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - standard imports import json diff --git a/frappe/chat/doctype/chat_message/test_chat_message.py b/frappe/chat/doctype/chat_message/test_chat_message.py index fc4e750719..46dac9858c 100644 --- a/frappe/chat/doctype/chat_message/test_chat_message.py +++ b/frappe/chat/doctype/chat_message/test_chat_message.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - standard imports import unittest diff --git a/frappe/chat/doctype/chat_profile/chat_profile.py b/frappe/chat/doctype/chat_profile/chat_profile.py index a26c76984a..22ce94858d 100644 --- a/frappe/chat/doctype/chat_profile/chat_profile.py +++ b/frappe/chat/doctype/chat_profile/chat_profile.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - module imports from frappe.model.document import Document from frappe import _ diff --git a/frappe/chat/doctype/chat_profile/test_chat_profile.py b/frappe/chat/doctype/chat_profile/test_chat_profile.py index a4f1bf359f..7c12b7179a 100644 --- a/frappe/chat/doctype/chat_profile/test_chat_profile.py +++ b/frappe/chat/doctype/chat_profile/test_chat_profile.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - standard imports import unittest @@ -16,7 +18,7 @@ class TestChatProfile(unittest.TestCase): # def test_create(self): # with self.assertRaises(frappe.ValidationError): # chat_profile.create(test_user) - + # user = get_user_doc(session.user) # if not user.chat_profile: # chat_profile.create(user.name) @@ -47,7 +49,7 @@ class TestChatProfile(unittest.TestCase): # )) # user = get_user_doc(session.user) - # prev = chat_profile.get(user.name) + # prev = chat_profile.get(user.name) # chat_profile.update(user.name, data = dict( # status = 'Offline' diff --git a/frappe/chat/doctype/chat_room/chat_room.py b/frappe/chat/doctype/chat_room/chat_room.py index 4de234f89b..db138ed08b 100644 --- a/frappe/chat/doctype/chat_room/chat_room.py +++ b/frappe/chat/doctype/chat_room/chat_room.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - standard imports import json diff --git a/frappe/chat/doctype/chat_room_user/chat_room_user.py b/frappe/chat/doctype/chat_room_user/chat_room_user.py index f6dbdc7659..f8e13add82 100644 --- a/frappe/chat/doctype/chat_room_user/chat_room_user.py +++ b/frappe/chat/doctype/chat_room_user/chat_room_user.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - module imports from frappe.model.document import Document import frappe diff --git a/frappe/chat/util/__init__.py b/frappe/chat/util/__init__.py index 383df581cd..15977af566 100644 --- a/frappe/chat/util/__init__.py +++ b/frappe/chat/util/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - module imports from frappe.chat.util.util import ( get_user_doc, diff --git a/frappe/chat/util/test_util.py b/frappe/chat/util/test_util.py index 8b07a1ca08..6d44a63d31 100644 --- a/frappe/chat/util/test_util.py +++ b/frappe/chat/util/test_util.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - standard imports import unittest @@ -7,6 +9,7 @@ from frappe.chat.util import ( safe_json_loads ) import frappe +import six class TestChatUtil(unittest.TestCase): def test_safe_json_loads(self): @@ -15,10 +18,10 @@ class TestChatUtil(unittest.TestCase): number = safe_json_loads("1.0") self.assertEqual(type(number), float) - + string = safe_json_loads("foobar") - self.assertEqual(type(string), str) - + self.assertEqual(type(string), six.text_type) + array = safe_json_loads('[{ "foo": "bar" }]') self.assertEqual(type(array), list) diff --git a/frappe/chat/util/util.py b/frappe/chat/util/util.py index c071cfa17e..5aa80a85ae 100644 --- a/frappe/chat/util/util.py +++ b/frappe/chat/util/util.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # imports - third-party imports import requests @@ -26,7 +28,7 @@ def get_user_doc(user = None): user = user or session.user user = frappe.get_doc('User', user) - + return user def squashify(what): @@ -43,9 +45,9 @@ def safe_json_loads(*args): arg = json.loads(arg) except Exception as e: pass - + results.append(arg) - + return squashify(results) def filter_dict(what, keys, ignore = False): @@ -68,7 +70,7 @@ def get_if_empty(a, b): if not a: a = b return a - + def listify(arg): if not isinstance(arg, list): arg = [arg] @@ -89,7 +91,7 @@ def check_url(what, raise_err = False): raise ValueError('{what} not a valid URL.') else: return False - + return True def create_test_user(module): @@ -110,5 +112,5 @@ def get_emojis(): if resp.ok: emojis = resp.json() redis.hset('frappe_emojis', 'emojis', emojis) - + return dictify(emojis) \ No newline at end of file diff --git a/frappe/chat/website/__init__.py b/frappe/chat/website/__init__.py index 4b8d2283df..f33f531cbf 100644 --- a/frappe/chat/website/__init__.py +++ b/frappe/chat/website/__init__.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.chat.util import filter_dict, safe_json_loads diff --git a/frappe/commands/scheduler.py b/frappe/commands/scheduler.py index caa0d7ed62..8d1cca286d 100755 --- a/frappe/commands/scheduler.py +++ b/frappe/commands/scheduler.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals, absolute_import, print_function import click -import json, sys +import sys import frappe from frappe.utils import cint from frappe.commands import pass_context, get_site diff --git a/frappe/commands/translate.py b/frappe/commands/translate.py index 1a94210566..5a48e2b409 100644 --- a/frappe/commands/translate.py +++ b/frappe/commands/translate.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals, absolute_import, print_function import click -import frappe from frappe.commands import pass_context, get_site # translation diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index b43d2db01e..fbae12c0b5 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -601,58 +601,27 @@ def get_version(): @click.option('--db_type') @click.option('--root_password') def setup_global_help(db_type=None, root_password=None): - '''setup help table in a separate database that will be + '''Deprecated: setup help table in a separate database that will be shared by the whole bench and set `global_help_setup` as 1 in common_site_config.json''' - - from frappe.installer import update_site_config - - frappe.local.flags = frappe._dict() - frappe.local.flags.in_setup_help = True - frappe.local.flags.in_install = True - frappe.local.lang = 'en' - frappe.local.conf = frappe.get_site_config(sites_path='.') - - update_site_config('global_help_setup', 1, - site_config_path=os.path.join('.', 'common_site_config.json')) - - if root_password: - frappe.local.conf.root_password = root_password - - if not frappe.local.conf.db_type: - frappe.local.conf.db_type = db_type - - - from frappe.utils.help import sync - sync() + print_in_app_help_deprecation() @click.command('get-docs-app') @click.argument('app') def get_docs_app(app): - '''Get the docs app for given app''' - from frappe.utils.help import setup_apps_for_docs - setup_apps_for_docs(app) + '''Deprecated: Get the docs app for given app''' + print_in_app_help_deprecation() @click.command('get-all-docs-apps') def get_all_docs_apps(): - '''Get docs apps for all apps''' - from frappe.utils.help import setup_apps_for_docs - for app in frappe.get_installed_apps(): - setup_apps_for_docs(app) + '''Deprecated: Get docs apps for all apps''' + print_in_app_help_deprecation() @click.command('setup-help') @pass_context def setup_help(context): - '''Setup help table in the current site (called after migrate)''' - from frappe.utils.help import sync - - for site in context.sites: - try: - frappe.init(site) - frappe.connect() - sync() - finally: - frappe.destroy() + '''Deprecated: Setup help table in the current site (called after migrate)''' + print_in_app_help_deprecation() @click.command('rebuild-global-search') @pass_context @@ -716,6 +685,10 @@ def auto_deploy(context, app, migrate=False, restart=False, remote='upstream'): else: print('No Updates') +def print_in_app_help_deprecation(): + print("In app help has been removed.\nYou can access the documentation on erpnext.com/docs or frappe.io/docs") + return + commands = [ build, clear_cache, @@ -746,8 +719,5 @@ commands = [ watch, _bulk_rename, add_to_email_queue, - setup_global_help, - setup_help, - rebuild_global_search, - auto_deploy + rebuild_global_search ] diff --git a/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py b/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py index 1d202d8379..b375874655 100644 --- a/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py +++ b/frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe import frappe.defaults import unittest diff --git a/frappe/core/doctype/docshare/test_docshare.py b/frappe/core/doctype/docshare/test_docshare.py index 10986d9eae..697930d6b5 100644 --- a/frappe/core/doctype/docshare/test_docshare.py +++ b/frappe/core/doctype/docshare/test_docshare.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt +from __future__ import unicode_literals import frappe import frappe.share import unittest diff --git a/frappe/core/utils.py b/frappe/core/utils.py index 89aba20cd8..e4c349da93 100644 --- a/frappe/core/utils.py +++ b/frappe/core/utils.py @@ -1,8 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt +from __future__ import unicode_literals import frappe -from frappe import _ + def get_parent_doc(doc): """Returns document of `reference_doctype`, `reference_doctype`""" diff --git a/frappe/core/web_form/edit_profile/edit_profile.json b/frappe/core/web_form/edit_profile/edit_profile.json index 1752284845..7072584670 100644 --- a/frappe/core/web_form/edit_profile/edit_profile.json +++ b/frappe/core/web_form/edit_profile/edit_profile.json @@ -18,7 +18,7 @@ "is_standard": 1, "login_required": 1, "max_attachment_size": 0, - "modified": "2018-11-01 19:35:43.552429", + "modified": "2019-01-28 12:45:17.158069", "modified_by": "Administrator", "module": "Core", "name": "edit-profile", @@ -129,19 +129,6 @@ "read_only": 0, "reqd": 0, "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "roles", - "fieldtype": "Table", - "hidden": 0, - "label": "Roles Assigned", - "max_length": 0, - "max_value": 0, - "options": "Has Role", - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 } ] } \ No newline at end of file diff --git a/frappe/custom/doctype/custom_field/custom_field.js b/frappe/custom/doctype/custom_field/custom_field.js index c430d12752..c59fabeaa6 100644 --- a/frappe/custom/doctype/custom_field/custom_field.js +++ b/frappe/custom/doctype/custom_field/custom_field.js @@ -9,6 +9,9 @@ frappe.ui.form.on('Custom Field', { frm.set_query('dt', function(doc) { var filters = [ ['DocType', 'issingle', '=', 0], + ['DocType', 'custom', '=', 0], + ['DocType', 'name', 'not in', frappe.model.core_doctypes_list], + ['DocType', 'restrict_to_domain', 'in', frappe.boot.active_domains] ]; if(frappe.session.user!=="Administrator") { filters.push(['DocType', 'module', 'not in', ['Core', 'Custom']]) @@ -32,15 +35,21 @@ frappe.ui.form.on('Custom Field', { return frappe.call({ method: 'frappe.custom.doctype.custom_field.custom_field.get_fields_label', args: { doctype: frm.doc.dt, fieldname: frm.doc.fieldname }, - callback: function(r, rt) { - set_field_options('insert_after', r.message); - var fieldnames = $.map(r.message, function(v) { return v.value; }); + callback: function(r) { + if(r) { + if(r._server_messages && r._server_messages.length) { + frm.set_value("dt", ""); + } else { + set_field_options('insert_after', r.message); + var fieldnames = $.map(r.message, function(v) { return v.value; }); - if(insert_after==null || !in_list(fieldnames, insert_after)) { - insert_after = fieldnames[-1]; + if(insert_after==null || !in_list(fieldnames, insert_after)) { + insert_after = fieldnames[-1]; + } + + frm.set_value('insert_after', insert_after); + } } - - frm.set_value('insert_after', insert_after); } }); diff --git a/frappe/custom/doctype/custom_field/custom_field.py b/frappe/custom/doctype/custom_field/custom_field.py index 361680af44..356a571adc 100644 --- a/frappe/custom/doctype/custom_field/custom_field.py +++ b/frappe/custom/doctype/custom_field/custom_field.py @@ -8,6 +8,7 @@ from frappe.utils import cstr from frappe import _ from frappe.model.document import Document from frappe.model.docfield import supports_translation +from frappe.model import core_doctypes_list class CustomField(Document): def autoname(self): @@ -85,6 +86,14 @@ class CustomField(Document): @frappe.whitelist() def get_fields_label(doctype=None): + meta = frappe.get_meta(doctype) + + if doctype in core_doctypes_list: + return frappe.msgprint(_("Custom Fields cannot be added to core DocTypes.")) + + if meta.custom: + return frappe.msgprint(_("Custom Fields can only be added to a standard DocType.")) + return [{"value": df.fieldname or "", "label": _(df.label or "")} for df in frappe.get_meta(doctype).get("fields")] diff --git a/frappe/custom/doctype/customize_form/customize_form.js b/frappe/custom/doctype/customize_form/customize_form.js index 227c6de1ee..125db507ea 100644 --- a/frappe/custom/doctype/customize_form/customize_form.js +++ b/frappe/custom/doctype/customize_form/customize_form.js @@ -13,9 +13,7 @@ frappe.ui.form.on("Customize Form", { filters: [ ['DocType', 'issingle', '=', 0], ['DocType', 'custom', '=', 0], - ['DocType', 'name', 'not in', 'DocType, DocField, DocPerm, User, Role, Has Role, \ - Page, Has Role, Module Def, Print Format, Report, Customize Form, \ - Customize Form Field, Property Setter, Custom Field, Custom Script'], + ['DocType', 'name', 'not in', frappe.model.core_doctypes_list], ['DocType', 'restrict_to_domain', 'in', frappe.boot.active_domains] ] }; @@ -39,8 +37,14 @@ frappe.ui.form.on("Customize Form", { doc: frm.doc, freeze: true, callback: function(r) { - frm.refresh(); - frm.trigger("setup_sortable"); + if(r) { + if(r._server_messages && r._server_messages.length) { + frm.set_value("doc_type", ""); + } else { + frm.refresh(); + frm.trigger("setup_sortable"); + } + } } }); } else { diff --git a/frappe/custom/doctype/customize_form/customize_form.py b/frappe/custom/doctype/customize_form/customize_form.py index 81ec0e2348..974dd84382 100644 --- a/frappe/custom/doctype/customize_form/customize_form.py +++ b/frappe/custom/doctype/customize_form/customize_form.py @@ -11,7 +11,7 @@ import frappe.translate from frappe import _ from frappe.utils import cint from frappe.model.document import Document -from frappe.model import no_value_fields +from frappe.model import no_value_fields, core_doctypes_list from frappe.core.doctype.doctype.doctype import validate_fields_for_doctype from frappe.model.docfield import supports_translation @@ -85,6 +85,12 @@ class CustomizeForm(Document): meta = frappe.get_meta(self.doc_type) + if self.doc_type in core_doctypes_list: + return frappe.msgprint(_("Core DocTypes cannot be customized.")) + + if meta.custom: + return frappe.msgprint(_("Only standard DocTypes are allowed to be customized from Customize Form.")) + # doctype properties for property in doctype_properties: self.set(property, meta.get(property)) diff --git a/frappe/custom/doctype/customize_form/test_customize_form.py b/frappe/custom/doctype/customize_form/test_customize_form.py index f76fc52609..7df3eedb5e 100644 --- a/frappe/custom/doctype/customize_form/test_customize_form.py +++ b/frappe/custom/doctype/customize_form/test_customize_form.py @@ -9,28 +9,28 @@ from frappe.core.doctype.doctype.doctype import InvalidFieldNameError test_dependencies = ["Custom Field", "Property Setter"] class TestCustomizeForm(unittest.TestCase): def insert_custom_field(self): - frappe.delete_doc_if_exists("Custom Field", "User-test_custom_field") + frappe.delete_doc_if_exists("Custom Field", "Event-test_custom_field") frappe.get_doc({ "doctype": "Custom Field", - "dt": "User", + "dt": "Event", "label": "Test Custom Field", "description": "A Custom Field for Testing", "fieldtype": "Select", "in_list_view": 1, "options": "\nCustom 1\nCustom 2\nCustom 3", "default": "Custom 3", - "insert_after": frappe.get_meta('User').fields[-1].fieldname + "insert_after": frappe.get_meta('Event').fields[-1].fieldname }).insert() def setUp(self): self.insert_custom_field() frappe.db.commit() - frappe.clear_cache(doctype="User") + frappe.clear_cache(doctype="Event") def tearDown(self): - frappe.delete_doc("Custom Field", "User-test_custom_field") + frappe.delete_doc("Custom Field", "Event-test_custom_field") frappe.db.commit() - frappe.clear_cache(doctype="User") + frappe.clear_cache(doctype="Event") def get_customize_form(self, doctype=None): d = frappe.get_doc("Customize Form") @@ -45,78 +45,67 @@ class TestCustomizeForm(unittest.TestCase): self.assertEqual(len(d.get("fields")), 0) d = self.get_customize_form("Event") - self.assertEqual(d.doc_type, "Event") - self.assertEqual(len(d.get("fields")), 27) + self.assertEquals(d.doc_type, "Event") + self.assertEquals(len(d.get("fields")), 30) - d = self.get_customize_form("User") - self.assertEqual(d.doc_type, "User") + d = self.get_customize_form("Event") + self.assertEquals(d.doc_type, "Event") self.assertEqual(len(d.get("fields")), len(frappe.get_doc("DocType", d.doc_type).fields) + 1) - self.assertEqual(d.get("fields")[-1].fieldname, "test_custom_field") - self.assertEqual(d.get("fields", {"fieldname": "location"})[0].in_list_view, 1) + self.assertEquals(d.get("fields")[-1].fieldname, "test_custom_field") + self.assertEquals(d.get("fields", {"fieldname": "event_type"})[0].in_list_view, 1) return d def test_save_customization_property(self): - d = self.get_customize_form("User") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "allow_copy"}, "value"), None) + d = self.get_customize_form("Event") + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "allow_copy"}, "value"), None) d.allow_copy = 1 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "allow_copy"}, "value"), '1') + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "allow_copy"}, "value"), '1') d.allow_copy = 0 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "allow_copy"}, "value"), None) + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "allow_copy"}, "value"), None) def test_save_customization_field_property(self): - d = self.get_customize_form("User") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "reqd", "field_name": "location"}, "value"), None) + d = self.get_customize_form("Event") + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "reqd", "field_name": "repeat_this_event"}, "value"), None) - location_field = d.get("fields", {"fieldname": "location"})[0] - location_field.reqd = 1 + repeat_this_event_field = d.get("fields", {"fieldname": "repeat_this_event"})[0] + repeat_this_event_field.reqd = 1 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "reqd", "field_name": "location"}, "value"), '1') + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "reqd", "field_name": "repeat_this_event"}, "value"), '1') - location_field = d.get("fields", {"fieldname": "location"})[0] - location_field.reqd = 0 + repeat_this_event_field = d.get("fields", {"fieldname": "repeat_this_event"})[0] + repeat_this_event_field.reqd = 0 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "reqd", "field_name": "location"}, "value"), None) - - # for not allowing to change mandatory property of standard fields - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "reqd", "field_name": "email"}, "value"), None) - - email_field = d.get("fields", {"fieldname": "email"})[0] - email_field.reqd = 0 - d.run_method("save_customization") - - self.assertEqual(frappe.db.get_value("Property Setter", - {"doc_type": "User", "property": "reqd", "field_name": "email"}, "value"), None) + self.assertEquals(frappe.db.get_value("Property Setter", + {"doc_type": "Event", "property": "reqd", "field_name": "repeat_this_event"}, "value"), None) def test_save_customization_custom_field_property(self): - d = self.get_customize_form("User") - self.assertEqual(frappe.db.get_value("Custom Field", "User-test_custom_field", "reqd"), 0) + d = self.get_customize_form("Event") + self.assertEquals(frappe.db.get_value("Custom Field", "Event-test_custom_field", "reqd"), 0) custom_field = d.get("fields", {"fieldname": "test_custom_field"})[0] custom_field.reqd = 1 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Custom Field", "User-test_custom_field", "reqd"), 1) + self.assertEquals(frappe.db.get_value("Custom Field", "Event-test_custom_field", "reqd"), 1) custom_field = d.get("fields", {"is_custom_field": True})[0] custom_field.reqd = 0 d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Custom Field", "User-test_custom_field", "reqd"), 0) + self.assertEquals(frappe.db.get_value("Custom Field", "Event-test_custom_field", "reqd"), 0) def test_save_customization_new_field(self): - d = self.get_customize_form("User") + d = self.get_customize_form("Event") last_fieldname = d.fields[-1].fieldname d.append("fields", { "label": "Test Add Custom Field Via Customize Form", @@ -124,19 +113,19 @@ class TestCustomizeForm(unittest.TestCase): "is_custom_field": 1 }) d.run_method("save_customization") - self.assertEqual(frappe.db.get_value("Custom Field", - "User-test_add_custom_field_via_customize_form", "fieldtype"), "Data") + self.assertEquals(frappe.db.get_value("Custom Field", + "Event-test_add_custom_field_via_customize_form", "fieldtype"), "Data") - self.assertEqual(frappe.db.get_value("Custom Field", - "User-test_add_custom_field_via_customize_form", 'insert_after'), last_fieldname) + self.assertEquals(frappe.db.get_value("Custom Field", + "Event-test_add_custom_field_via_customize_form", 'insert_after'), last_fieldname) - frappe.delete_doc("Custom Field", "User-test_add_custom_field_via_customize_form") - self.assertEqual(frappe.db.get_value("Custom Field", - "User-test_add_custom_field_via_customize_form"), None) + frappe.delete_doc("Custom Field", "Event-test_add_custom_field_via_customize_form") + self.assertEquals(frappe.db.get_value("Custom Field", + "Event-test_add_custom_field_via_customize_form"), None) def test_save_customization_remove_field(self): - d = self.get_customize_form("User") + d = self.get_customize_form("Event") custom_field = d.get("fields", {"fieldname": "test_custom_field"})[0] d.get("fields").remove(custom_field) d.run_method("save_customization") @@ -148,24 +137,24 @@ class TestCustomizeForm(unittest.TestCase): def test_reset_to_defaults(self): d = frappe.get_doc("Customize Form") - d.doc_type = "User" + d.doc_type = "Event" d.run_method('reset_to_defaults') - self.assertEqual(d.get("fields", {"fieldname": "location"})[0].in_list_view, 0) + self.assertEquals(d.get("fields", {"fieldname": "repeat_this_event"})[0].in_list_view, 0) frappe.local.test_objects["Property Setter"] = [] make_test_records_for_doctype("Property Setter") def test_set_allow_on_submit(self): - d = self.get_customize_form("User") - d.get("fields", {"fieldname": "first_name"})[0].allow_on_submit = 1 + d = self.get_customize_form("Event") + d.get("fields", {"fieldname": "subject"})[0].allow_on_submit = 1 d.get("fields", {"fieldname": "test_custom_field"})[0].allow_on_submit = 1 d.run_method("save_customization") - d = self.get_customize_form("User") + d = self.get_customize_form("Event") # don't allow for standard fields - self.assertEqual(d.get("fields", {"fieldname": "first_name"})[0].allow_on_submit or 0, 0) + self.assertEquals(d.get("fields", {"fieldname": "subject"})[0].allow_on_submit or 0, 0) # allow for custom field self.assertEqual(d.get("fields", {"fieldname": "test_custom_field"})[0].allow_on_submit, 1) @@ -193,4 +182,12 @@ class TestCustomizeForm(unittest.TestCase): # undo df.default = None - d.run_method("save_customization") \ No newline at end of file + d.run_method("save_customization") + + def test_core_doctype_customization(self): + d = self.get_customize_form('User') + e = self.get_customize_form('Custom Field') + + # core doctype is invalid, hence no attributes are set + self.assertEquals(d.get("fields"), []) + self.assertEquals(e.get("fields"), []) diff --git a/frappe/data_migration/doctype/data_migration_connector/connectors/base.py b/frappe/data_migration/doctype/data_migration_connector/connectors/base.py index f500b4a7e8..97f9f5f4a3 100644 --- a/frappe/data_migration/doctype/data_migration_connector/connectors/base.py +++ b/frappe/data_migration/doctype/data_migration_connector/connectors/base.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals from six import with_metaclass from abc import ABCMeta, abstractmethod from frappe.utils.password import get_decrypted_password diff --git a/frappe/desk/doctype/note/test_note.py b/frappe/desk/doctype/note/test_note.py index 865527b5a0..8d46eaf336 100644 --- a/frappe/desk/doctype/note/test_note.py +++ b/frappe/desk/doctype/note/test_note.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt +from __future__ import unicode_literals import frappe import unittest diff --git a/frappe/desk/notifications.py b/frappe/desk/notifications.py index b3100a43da..43b67f2976 100644 --- a/frappe/desk/notifications.py +++ b/frappe/desk/notifications.py @@ -12,8 +12,15 @@ import json @frappe.whitelist() @frappe.read_only() def get_notifications(): - if frappe.flags.in_install: - return + if (frappe.flags.in_install or + not frappe.db.get_single_value('System Settings', 'setup_complete')): + return { + "open_count_doctype": {}, + "open_count_module": {}, + "open_count_other": {}, + "targets": {}, + "new_messages": [] + } config = get_notification_config() @@ -108,7 +115,8 @@ def get_notifications_for_doctypes(config, notification_count): except Exception as e: # OperationalError: (1412, 'Table definition has changed, please retry transaction') - if e.args[0]!=1412: + # InternalError: (1684, 'Table definition is being modified by concurrent DDL statement') + if e.args[0] not in (1412, 1684): raise else: @@ -148,7 +156,7 @@ def get_notifications_for_targets(config, notification_percent): frappe.clear_messages() pass except Exception as e: - if e.args[0]!=1412: + if e.args[0] not in (1412, 1684): raise else: diff --git a/frappe/desk/page/backups/backups.py b/frappe/desk/page/backups/backups.py index 2d493515b7..663ab37cff 100644 --- a/frappe/desk/page/backups/backups.py +++ b/frappe/desk/page/backups/backups.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import os import frappe from frappe import _ diff --git a/frappe/desk/query_builder.py b/frappe/desk/query_builder.py index ef6240b8dd..81eba35e05 100644 --- a/frappe/desk/query_builder.py +++ b/frappe/desk/query_builder.py @@ -220,9 +220,6 @@ def runquery(q='', ret=0, from_export=0): def runquery_csv(): global out - # run query - res = runquery(from_export = 1) - q = frappe.form_dict.get('query') rep_name = frappe.form_dict.get('report_name') @@ -234,9 +231,6 @@ def runquery_csv(): if not rep_name: rep_name = 'DataExport' - # Headings - heads = [] - rows = [[rep_name], out['colnames']] + out['values'] from six import StringIO diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index a68f1677de..b5c5ce5434 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -254,7 +254,7 @@ def export_query(): if row and (i in visible_idx): row_list = [] for idx in range(len(data.columns)): - row_list.append(row.get(columns[idx]["fieldname"],"")) + row_list.append(row.get(columns[idx]["fieldname"], row.get(columns[idx]["label"], ""))) result.append(row_list) elif not row: result.append([]) diff --git a/frappe/desk/reportview.py b/frappe/desk/reportview.py index 300145b780..362f883581 100644 --- a/frappe/desk/reportview.py +++ b/frappe/desk/reportview.py @@ -42,7 +42,6 @@ def get_form_params(): else: data["save_user_settings"] = True - doctype = data["doctype"] fields = data["fields"] for field in fields: @@ -213,7 +212,7 @@ def delete_items(): """delete selected items""" import json - il = sorted(json.loads(frappe.form_dict.get('items')), reverse=True, key=str) + il = sorted(json.loads(frappe.form_dict.get('items')), reverse=True, key=frappe.safe_decode) doctype = frappe.form_dict.get('doctype') failed = [] diff --git a/frappe/email/doctype/email_account/email_account.json b/frappe/email/doctype/email_account/email_account.json index 61167f9f63..b306692739 100644 --- a/frappe/email/doctype/email_account/email_account.json +++ b/frappe/email/doctype/email_account/email_account.json @@ -1130,6 +1130,39 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "no_smtp_authentication", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Disable SMTP server authentication", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -1566,4 +1599,4 @@ "track_changes": 1, "track_seen": 0, "track_views": 0 -} \ No newline at end of file +} diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index f61ee02806..34cd3c24ee 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -72,7 +72,7 @@ class EmailAccount(Document): if self.enable_outgoing: self.check_smtp() else: - if self.enable_incoming or self.enable_outgoing: + if self.enable_incoming or (self.enable_outgoing and not self.no_smtp_authentication): frappe.throw(_("Password is required or select Awaiting Password")) if self.notify_if_unreplied: @@ -134,8 +134,9 @@ class EmailAccount(Document): port = cint(self.smtp_port), use_tls = cint(self.use_tls) ) - if self.password: + if self.password and not self.no_smtp_authentication: server.password = self.get_password() + server.sess def get_incoming_server(self, in_receive=False, email_sync_rule="UNSEEN"): diff --git a/frappe/email/doctype/email_account/test_email_account.py b/frappe/email/doctype/email_account/test_email_account.py index 849cb6b42c..f098a8b205 100644 --- a/frappe/email/doctype/email_account/test_email_account.py +++ b/frappe/email/doctype/email_account/test_email_account.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt +from __future__ import unicode_literals import frappe, os import unittest, email diff --git a/frappe/email/email_body.py b/frappe/email/email_body.py index aba41e8813..b4af93e61d 100755 --- a/frappe/email/email_body.py +++ b/frappe/email/email_body.py @@ -6,7 +6,7 @@ import frappe, re, os from frappe.utils.pdf import get_pdf from frappe.email.smtp import get_outgoing_email_account from frappe.utils import (get_url, scrub_urls, strip, expand_relative_urls, cint, - split_emails, to_markdown, markdown, encode, random_string, parse_addr) + split_emails, to_markdown, markdown, random_string, parse_addr) import email.utils from six import iteritems, text_type, string_types from email.mime.multipart import MIMEMultipart diff --git a/frappe/email/inbox.py b/frappe/email/inbox.py index 5c8d33793a..6cfcf9f263 100644 --- a/frappe/email/inbox.py +++ b/frappe/email/inbox.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe import json diff --git a/frappe/email/smtp.py b/frappe/email/smtp.py index fa6b92fc33..549b3f1d1e 100644 --- a/frappe/email/smtp.py +++ b/frappe/email/smtp.py @@ -88,7 +88,7 @@ def get_outgoing_email_account(raise_exception_not_set=True, append_to=None, sen if email_account: if email_account.enable_outgoing and not getattr(email_account, 'from_site_config', False): raise_exception = True - if email_account.smtp_server in ['localhost','127.0.0.1']: + if email_account.smtp_server in ['localhost','127.0.0.1'] or email_account.no_smtp_authentication: raise_exception = False email_account.password = email_account.get_password(raise_exception=raise_exception) email_account.default_sender = email.utils.formataddr((email_account.name, email_account.get("email_id"))) @@ -170,11 +170,14 @@ class SMTPServer: self.email_account = get_outgoing_email_account(raise_exception_not_set=False, append_to=append_to, sender=sender) if self.email_account: self.server = self.email_account.smtp_server - self.login = getattr(self.email_account, "login_id", None) or self.email_account.email_id - if self.email_account.ascii_encode_password: - self.password = frappe.safe_encode(self.email_account.password, 'ascii') + self.login = (getattr(self.email_account, "login_id", None) or self.email_account.email_id) + if not self.email_account.no_smtp_authentication: + if self.email_account.ascii_encode_password: + self.password = frappe.safe_encode(self.email_account.password, 'ascii') + else: + self.password = self.email_account.password else: - self.password = self.email_account.password + self.password = None self.port = self.email_account.smtp_port self.use_tls = self.email_account.use_tls self.sender = self.email_account.email_id @@ -210,7 +213,7 @@ class SMTPServer: self._sess.ehlo() if self.login and self.password: - ret = self._sess.login((self.login or ""), (self.password or "")) + ret = self._sess.login(str(self.login or ""), str(self.password or "")) # check if logged correctly if ret[0]!=235: diff --git a/frappe/email/test_email_body.py b/frappe/email/test_email_body.py index 3f6502cdd4..b0bfddd4f0 100644 --- a/frappe/email/test_email_body.py +++ b/frappe/email/test_email_body.py @@ -2,7 +2,7 @@ # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals -import frappe, unittest, os, base64 +import unittest, os, base64 from frappe.email.email_body import (replace_filename_with_cid, get_email, inline_style_in_html, get_header) diff --git a/frappe/frappeclient.py b/frappe/frappeclient.py index f1f57c2fe4..3e11f9d72f 100644 --- a/frappe/frappeclient.py +++ b/frappe/frappeclient.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import requests import json import frappe diff --git a/frappe/geo/doctype/country/test_country.py b/frappe/geo/doctype/country/test_country.py index 110e38e2b5..81849d6886 100644 --- a/frappe/geo/doctype/country/test_country.py +++ b/frappe/geo/doctype/country/test_country.py @@ -1,6 +1,6 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: See license.txt - +from __future__ import unicode_literals import frappe test_records = frappe.get_test_records('Country') \ No newline at end of file diff --git a/frappe/geo/doctype/currency/test_currency.py b/frappe/geo/doctype/currency/test_currency.py index 5552e675ec..7945e193da 100644 --- a/frappe/geo/doctype/currency/test_currency.py +++ b/frappe/geo/doctype/currency/test_currency.py @@ -3,5 +3,6 @@ # pre loaded +from __future__ import unicode_literals import frappe test_records = frappe.get_test_records('Currency') \ No newline at end of file diff --git a/frappe/hooks.py b/frappe/hooks.py index 71b0427803..aaa046558a 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -12,7 +12,7 @@ source_link = "https://github.com/frappe/frappe" app_license = "MIT" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.51' +staging_version = '11.1.0' app_email = "info@frappe.io" diff --git a/frappe/integrations/data_migration_mapping/gcalendar_to_event/__init__.py b/frappe/integrations/data_migration_mapping/gcalendar_to_event/__init__.py index 7656173c9b..441d2c3797 100644 --- a/frappe/integrations/data_migration_mapping/gcalendar_to_event/__init__.py +++ b/frappe/integrations/data_migration_mapping/gcalendar_to_event/__init__.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import unicode_literals import frappe from datetime import datetime from dateutil.parser import parse diff --git a/frappe/integrations/doctype/social_login_keys/social_login_keys.py b/frappe/integrations/doctype/social_login_keys/social_login_keys.py index da9e21cd8e..bd4cea01af 100644 --- a/frappe/integrations/doctype/social_login_keys/social_login_keys.py +++ b/frappe/integrations/doctype/social_login_keys/social_login_keys.py @@ -1,4 +1,5 @@ # see license +from __future__ import unicode_literals from frappe.model.document import Document class SocialLoginKeys(Document): diff --git a/frappe/integrations/doctype/webhook/__init__.py b/frappe/integrations/doctype/webhook/__init__.py index b72acc0578..75af2b360a 100644 --- a/frappe/integrations/doctype/webhook/__init__.py +++ b/frappe/integrations/doctype/webhook/__init__.py @@ -2,6 +2,7 @@ # Copyright (c) 2017, Frappe Technologies and contributors # For license information, please see license.txt +from __future__ import unicode_literals import frappe def run_webhooks(doc, method): @@ -37,7 +38,7 @@ def run_webhooks(doc, method): def _webhook_request(webhook): if not webhook.name in frappe.flags.webhooks_executed.get(doc.name, []): - frappe.enqueue("frappe.integrations.doctype.webhook.webhook.enqueue_webhook", + frappe.enqueue("frappe.integrations.doctype.webhook.webhook.enqueue_webhook", enqueue_after_commit=True, doc=doc, webhook=webhook) # keep list of webhooks executed for this doc in this request diff --git a/frappe/migrate.py b/frappe/migrate.py index d0fc2bf93c..956b4a3c93 100644 --- a/frappe/migrate.py +++ b/frappe/migrate.py @@ -14,7 +14,6 @@ from frappe.website import render, router from frappe.desk.doctype.desktop_icon.desktop_icon import sync_desktop_icons from frappe.core.doctype.language.language import sync_languages from frappe.modules.utils import sync_customizations -import frappe.utils.help def migrate(verbose=True, rebuild_website=False): '''Migrate all apps to the latest version, will: @@ -60,10 +59,6 @@ def migrate(verbose=True, rebuild_website=False): frappe.db.commit() - if not frappe.conf.get('global_help_setup'): - # sync help if not set as global - frappe.utils.help.sync() - clear_notifications() frappe.publish_realtime("version-update") diff --git a/frappe/model/__init__.py b/frappe/model/__init__.py index 3b5c91ee17..40ab9e3e5b 100644 --- a/frappe/model/__init__.py +++ b/frappe/model/__init__.py @@ -4,7 +4,6 @@ # model __init__.py from __future__ import unicode_literals import frappe -import json data_fieldtypes = ( 'Currency', @@ -45,6 +44,27 @@ default_fields = ('doctype','name','owner','creation','modified','modified_by', 'parent','parentfield','parenttype','idx','docstatus') optional_fields = ("_user_tags", "_comments", "_assign", "_liked_by", "_seen") table_fields = ('Table', 'Table MultiSelect') +core_doctypes_list = ('DocType', 'DocField', 'DocPerm', 'User', 'Role', 'Has Role', + 'Page', 'Module Def', 'Print Format', 'Report', 'Customize Form', + 'Customize Form Field', 'Property Setter', 'Custom Field', 'Custom Script') + +def copytables(srctype, src, srcfield, tartype, tar, tarfield, srcfields, tarfields=[]): + if not tarfields: + tarfields = srcfields + l = [] + data = src.get(srcfield) + for d in data: + newrow = tar.append(tarfield) + newrow.idx = d.idx + + for i in range(len(srcfields)): + newrow.set(tarfields[i], d.get(srcfields[i])) + + l.append(newrow) + return l + +def db_exists(dt, dn): + return frappe.db.exists(dt, dn) def delete_fields(args_dict, delete=0): """ diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 78bc62ee91..178bc427eb 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -451,6 +451,19 @@ class DatabaseQuery(object): value = get_time(f.value).strftime("%H:%M:%S.%f") fallback = "'00:00:00'" + elif f.operator.lower() == "is": + if f.value == 'set': + f.operator = '!=' + elif f.value == 'not set': + f.operator = '=' + + value = "" + fallback = '""' + can_be_null = True + + if 'ifnull' not in column_name: + column_name = 'ifnull({}, {})'.format(column_name, fallback) + elif f.operator.lower() in ("like", "not like") or (isinstance(f.value, string_types) and (not df or df.fieldtype not in ["Float", "Int", "Currency", "Percent", "Check"])): value = "" if f.value==None else f.value diff --git a/frappe/model/dynamic_links.py b/frappe/model/dynamic_links.py index fcd0b9234b..e5ce9102e2 100644 --- a/frappe/model/dynamic_links.py +++ b/frappe/model/dynamic_links.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt +from __future__ import unicode_literals import frappe # select doctypes that are accessed by the user (not read_only) first, so that the diff --git a/frappe/model/utils/user_settings.py b/frappe/model/utils/user_settings.py index 2cbfa50026..d59bda71a5 100644 --- a/frappe/model/utils/user_settings.py +++ b/frappe/model/utils/user_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals # Settings saved per user basis # such as page_limit, filters, last_view diff --git a/frappe/modules/__init__.py b/frappe/modules/__init__.py index 90f60fdd89..fef4829bb6 100644 --- a/frappe/modules/__init__.py +++ b/frappe/modules/__init__.py @@ -1 +1,2 @@ +from __future__ import unicode_literals from .utils import * \ No newline at end of file diff --git a/frappe/modules/export_file.py b/frappe/modules/export_file.py index 275db10b13..66a6a9f6b7 100644 --- a/frappe/modules/export_file.py +++ b/frappe/modules/export_file.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals -import frappe, os, json +import frappe, os import frappe.model from frappe.modules import scrub, get_module_path, scrub_dt_dn diff --git a/frappe/oauth.py b/frappe/oauth.py index f529694407..4dc50366be 100644 --- a/frappe/oauth.py +++ b/frappe/oauth.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import frappe import pytz diff --git a/frappe/patches.txt b/frappe/patches.txt index 3dcdf654c0..a79dbf2146 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -222,7 +222,6 @@ frappe.patches.v11_0.rename_workflow_action_to_workflow_action_master #13-06-201 frappe.patches.v11_0.rename_email_alert_to_notification #13-06-2018 frappe.patches.v11_0.delete_duplicate_user_permissions frappe.patches.v11_0.set_dropbox_file_backup -frappe.patches.v11_0.get_docs_apps_if_not_present frappe.patches.v10_0.set_default_locking_time frappe.patches.v11_0.rename_google_maps_doctype frappe.patches.v10_0.modify_smallest_currency_fraction diff --git a/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py b/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py index 09d7b42ce7..eddca78051 100644 --- a/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py +++ b/frappe/patches/v10_0/enable_chat_by_default_within_system_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v10_0/enhance_security.py b/frappe/patches/v10_0/enhance_security.py index 6a9c371b51..865d18dcff 100644 --- a/frappe/patches/v10_0/enhance_security.py +++ b/frappe/patches/v10_0/enhance_security.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe diff --git a/frappe/patches/v10_0/increase_single_table_column_length.py b/frappe/patches/v10_0/increase_single_table_column_length.py index 3c2a2b3233..18de0cff9e 100644 --- a/frappe/patches/v10_0/increase_single_table_column_length.py +++ b/frappe/patches/v10_0/increase_single_table_column_length.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals """ Run this after updating country_info.json and or """ diff --git a/frappe/patches/v10_0/migrate_passwords_passlib.py b/frappe/patches/v10_0/migrate_passwords_passlib.py index 47a59f4ef5..22b7a86f85 100644 --- a/frappe/patches/v10_0/migrate_passwords_passlib.py +++ b/frappe/patches/v10_0/migrate_passwords_passlib.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils.password import LegacyPassword diff --git a/frappe/patches/v10_0/modify_naming_series_table.py b/frappe/patches/v10_0/modify_naming_series_table.py index d98ab1edd1..659e247a38 100644 --- a/frappe/patches/v10_0/modify_naming_series_table.py +++ b/frappe/patches/v10_0/modify_naming_series_table.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals ''' Modify the Integer 10 Digits Value to BigInt 20 Digit value diff --git a/frappe/patches/v10_0/modify_smallest_currency_fraction.py b/frappe/patches/v10_0/modify_smallest_currency_fraction.py index c9ae477359..f875d6b87d 100644 --- a/frappe/patches/v10_0/modify_smallest_currency_fraction.py +++ b/frappe/patches/v10_0/modify_smallest_currency_fraction.py @@ -1,6 +1,7 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v10_0/refactor_social_login_keys.py b/frappe/patches/v10_0/refactor_social_login_keys.py index da834c763a..07737912df 100644 --- a/frappe/patches/v10_0/refactor_social_login_keys.py +++ b/frappe/patches/v10_0/refactor_social_login_keys.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils import cstr diff --git a/frappe/patches/v10_0/reload_countries_and_currencies.py b/frappe/patches/v10_0/reload_countries_and_currencies.py index 927fb10a7c..f83ed9c3aa 100644 --- a/frappe/patches/v10_0/reload_countries_and_currencies.py +++ b/frappe/patches/v10_0/reload_countries_and_currencies.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals """ Run this after updating country_info.json and or """ diff --git a/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py b/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py index 65e616ea3f..f27639388e 100644 --- a/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py +++ b/frappe/patches/v10_0/remove_custom_field_for_disabled_domain.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v10_0/set_default_locking_time.py b/frappe/patches/v10_0/set_default_locking_time.py index 045fa0e3fa..1c9797a6cc 100644 --- a/frappe/patches/v10_0/set_default_locking_time.py +++ b/frappe/patches/v10_0/set_default_locking_time.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v10_0/set_no_copy_to_workflow_state.py b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py index 00ca125bf7..800d4a4d1b 100644 --- a/frappe/patches/v10_0/set_no_copy_to_workflow_state.py +++ b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/change_email_signature_fieldtype.py b/frappe/patches/v11_0/change_email_signature_fieldtype.py index ccfa8541c3..f6d4bd5dcb 100644 --- a/frappe/patches/v11_0/change_email_signature_fieldtype.py +++ b/frappe/patches/v11_0/change_email_signature_fieldtype.py @@ -1,6 +1,7 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/copy_fetch_data_from_options.py b/frappe/patches/v11_0/copy_fetch_data_from_options.py index 4c69a75c55..ae7788450a 100644 --- a/frappe/patches/v11_0/copy_fetch_data_from_options.py +++ b/frappe/patches/v11_0/copy_fetch_data_from_options.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/delete_all_prepared_reports.py b/frappe/patches/v11_0/delete_all_prepared_reports.py index 2204f90a8d..10bc049895 100644 --- a/frappe/patches/v11_0/delete_all_prepared_reports.py +++ b/frappe/patches/v11_0/delete_all_prepared_reports.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/delete_duplicate_user_permissions.py b/frappe/patches/v11_0/delete_duplicate_user_permissions.py index 22369fb78e..9795d2dead 100644 --- a/frappe/patches/v11_0/delete_duplicate_user_permissions.py +++ b/frappe/patches/v11_0/delete_duplicate_user_permissions.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/drop_column_apply_user_permissions.py b/frappe/patches/v11_0/drop_column_apply_user_permissions.py index b1e4ea05f8..ed0a6881af 100644 --- a/frappe/patches/v11_0/drop_column_apply_user_permissions.py +++ b/frappe/patches/v11_0/drop_column_apply_user_permissions.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/fix_order_by_in_reports_json.py b/frappe/patches/v11_0/fix_order_by_in_reports_json.py index 561efdcee3..2cd82d442d 100644 --- a/frappe/patches/v11_0/fix_order_by_in_reports_json.py +++ b/frappe/patches/v11_0/fix_order_by_in_reports_json.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json def execute(): diff --git a/frappe/patches/v11_0/get_docs_apps_if_not_present.py b/frappe/patches/v11_0/get_docs_apps_if_not_present.py deleted file mode 100644 index 83f95247bf..0000000000 --- a/frappe/patches/v11_0/get_docs_apps_if_not_present.py +++ /dev/null @@ -1,6 +0,0 @@ -import frappe -from frappe.utils.help import setup_apps_for_docs - -def execute(): - for app in frappe.get_installed_apps(): - setup_apps_for_docs(app) diff --git a/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py b/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py index 9e5ce727c0..5bef52c295 100644 --- a/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py +++ b/frappe/patches/v11_0/migrate_report_settings_for_new_listview.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json def execute(): diff --git a/frappe/patches/v11_0/multiple_references_in_events.py b/frappe/patches/v11_0/multiple_references_in_events.py index 86dd36f660..57d4787eca 100644 --- a/frappe/patches/v11_0/multiple_references_in_events.py +++ b/frappe/patches/v11_0/multiple_references_in_events.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/reload_and_rename_view_log.py b/frappe/patches/v11_0/reload_and_rename_view_log.py index 6d001228fd..611de79a3c 100644 --- a/frappe/patches/v11_0/reload_and_rename_view_log.py +++ b/frappe/patches/v11_0/reload_and_rename_view_log.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/remove_skip_for_doctype.py b/frappe/patches/v11_0/remove_skip_for_doctype.py index 1849cb7bcd..c3b9ffff80 100644 --- a/frappe/patches/v11_0/remove_skip_for_doctype.py +++ b/frappe/patches/v11_0/remove_skip_for_doctype.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.desk.form.linked_with import get_linked_doctypes from frappe.patches.v11_0.replicate_old_user_permissions import get_doctypes_to_skip diff --git a/frappe/patches/v11_0/rename_email_alert_to_notification.py b/frappe/patches/v11_0/rename_email_alert_to_notification.py index fee6fd2f0d..727055fcc4 100644 --- a/frappe/patches/v11_0/rename_email_alert_to_notification.py +++ b/frappe/patches/v11_0/rename_email_alert_to_notification.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.model.rename_doc import rename_doc diff --git a/frappe/patches/v11_0/rename_google_maps_doctype.py b/frappe/patches/v11_0/rename_google_maps_doctype.py index 1423cd70e4..5420dcfc20 100644 --- a/frappe/patches/v11_0/rename_google_maps_doctype.py +++ b/frappe/patches/v11_0/rename_google_maps_doctype.py @@ -1,7 +1,8 @@ -import frappe -from frappe.model.rename_doc import rename_doc - -def execute(): - if frappe.db.exists("DocType","Google Maps") and not frappe.db.exists("DocType","Google Maps Settings"): - rename_doc('DocType', 'Google Maps', 'Google Maps Settings') +from __future__ import unicode_literals +import frappe +from frappe.model.rename_doc import rename_doc + +def execute(): + if frappe.db.exists("DocType","Google Maps") and not frappe.db.exists("DocType","Google Maps Settings"): + rename_doc('DocType', 'Google Maps', 'Google Maps Settings') frappe.reload_doc('integrations', 'doctype', 'google_maps_settings') \ No newline at end of file diff --git a/frappe/patches/v11_0/rename_standard_reply_to_email_template.py b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py index f5b86b9149..06869530e2 100644 --- a/frappe/patches/v11_0/rename_standard_reply_to_email_template.py +++ b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.model.rename_doc import rename_doc diff --git a/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py b/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py index ff7bbcb719..32f17ac2d8 100644 --- a/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py +++ b/frappe/patches/v11_0/rename_workflow_action_to_workflow_action_master.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.model.rename_doc import rename_doc diff --git a/frappe/patches/v11_0/replicate_old_user_permissions.py b/frappe/patches/v11_0/replicate_old_user_permissions.py index 63b072502d..d1ceae8a7f 100644 --- a/frappe/patches/v11_0/replicate_old_user_permissions.py +++ b/frappe/patches/v11_0/replicate_old_user_permissions.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe import json from frappe.utils import cint diff --git a/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py b/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py index 99a2b6f536..24c01e1a58 100644 --- a/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py +++ b/frappe/patches/v11_0/set_allow_self_approval_in_workflow.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py b/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py index 211e25fb95..331b0eba32 100644 --- a/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py +++ b/frappe/patches/v11_0/sync_stripe_settings_before_migrate.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils.password import get_decrypted_password diff --git a/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py b/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py index 612d83bf97..738fea1a48 100644 --- a/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py +++ b/frappe/patches/v11_0/sync_user_permission_doctype_before_migrate.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/clear_website_group_and_notifications.py b/frappe/patches/v5_0/clear_website_group_and_notifications.py index 66bd68d5e1..bad50222a3 100644 --- a/frappe/patches/v5_0/clear_website_group_and_notifications.py +++ b/frappe/patches/v5_0/clear_website_group_and_notifications.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/communication_parent.py b/frappe/patches/v5_0/communication_parent.py index 494c9b218b..2ea3b401c6 100644 --- a/frappe/patches/v5_0/communication_parent.py +++ b/frappe/patches/v5_0/communication_parent.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/expire_old_scheduler_logs.py b/frappe/patches/v5_0/expire_old_scheduler_logs.py index 2d107d26f6..8b65ed5fb1 100644 --- a/frappe/patches/v5_0/expire_old_scheduler_logs.py +++ b/frappe/patches/v5_0/expire_old_scheduler_logs.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/modify_session.py b/frappe/patches/v5_0/modify_session.py index 2aaf2da97b..f0e247a633 100644 --- a/frappe/patches/v5_0/modify_session.py +++ b/frappe/patches/v5_0/modify_session.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py b/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py index 749067612b..0fa1dad1e5 100644 --- a/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py +++ b/frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v5_0/rename_table_fieldnames.py b/frappe/patches/v5_0/rename_table_fieldnames.py index 79703bbba2..b716599f28 100644 --- a/frappe/patches/v5_0/rename_table_fieldnames.py +++ b/frappe/patches/v5_0/rename_table_fieldnames.py @@ -1,6 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals import frappe from frappe.model.utils.rename_field import rename_field from frappe.modules import scrub, get_doctype_module diff --git a/frappe/patches/v5_0/update_shared.py b/frappe/patches/v5_0/update_shared.py index 4ba908b334..f2b77895d8 100644 --- a/frappe/patches/v5_0/update_shared.py +++ b/frappe/patches/v5_0/update_shared.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe import frappe.share diff --git a/frappe/patches/v6_0/document_type_rename.py b/frappe/patches/v6_0/document_type_rename.py index 0d9ca7da0e..16c7d34286 100644 --- a/frappe/patches/v6_0/document_type_rename.py +++ b/frappe/patches/v6_0/document_type_rename.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_0/fix_ghana_currency.py b/frappe/patches/v6_0/fix_ghana_currency.py index 10365148b1..67f740d240 100644 --- a/frappe/patches/v6_0/fix_ghana_currency.py +++ b/frappe/patches/v6_0/fix_ghana_currency.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals def execute(): from frappe.geo.country_info import get_all diff --git a/frappe/patches/v6_0/make_task_log_folder.py b/frappe/patches/v6_0/make_task_log_folder.py index f557b5c8a1..87d6e4126f 100644 --- a/frappe/patches/v6_0/make_task_log_folder.py +++ b/frappe/patches/v6_0/make_task_log_folder.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe.utils, os def execute(): diff --git a/frappe/patches/v6_1/rename_file_data.py b/frappe/patches/v6_1/rename_file_data.py index 079e16cdcd..83152271eb 100644 --- a/frappe/patches/v6_1/rename_file_data.py +++ b/frappe/patches/v6_1/rename_file_data.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_11/rename_field_in_email_account.py b/frappe/patches/v6_11/rename_field_in_email_account.py index 8462ab66ad..319b569802 100644 --- a/frappe/patches/v6_11/rename_field_in_email_account.py +++ b/frappe/patches/v6_11/rename_field_in_email_account.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_15/set_username.py b/frappe/patches/v6_15/set_username.py index 4e62cad178..513ff3301d 100644 --- a/frappe/patches/v6_15/set_username.py +++ b/frappe/patches/v6_15/set_username.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_2/rename_backup_manager.py b/frappe/patches/v6_2/rename_backup_manager.py index 974a4fe7d6..af02e55878 100644 --- a/frappe/patches/v6_2/rename_backup_manager.py +++ b/frappe/patches/v6_2/rename_backup_manager.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_20x/remove_roles_from_website_user.py b/frappe/patches/v6_20x/remove_roles_from_website_user.py index 499ad5ddf4..a4d579a1f0 100644 --- a/frappe/patches/v6_20x/remove_roles_from_website_user.py +++ b/frappe/patches/v6_20x/remove_roles_from_website_user.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_20x/set_allow_draft_for_print.py b/frappe/patches/v6_20x/set_allow_draft_for_print.py index 3c1008496e..90c15e22b2 100644 --- a/frappe/patches/v6_20x/set_allow_draft_for_print.py +++ b/frappe/patches/v6_20x/set_allow_draft_for_print.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v6_20x/update_insert_after.py b/frappe/patches/v6_20x/update_insert_after.py index b7d5166d0b..5ebec52fc9 100644 --- a/frappe/patches/v6_20x/update_insert_after.py +++ b/frappe/patches/v6_20x/update_insert_after.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json def execute(): diff --git a/frappe/patches/v6_24/set_language_as_code.py b/frappe/patches/v6_24/set_language_as_code.py index 0679459783..d685fd7d0e 100644 --- a/frappe/patches/v6_24/set_language_as_code.py +++ b/frappe/patches/v6_24/set_language_as_code.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.translate import get_lang_dict diff --git a/frappe/patches/v6_24/sync_desktop_icons.py b/frappe/patches/v6_24/sync_desktop_icons.py index a635990732..74f52e6056 100644 --- a/frappe/patches/v6_24/sync_desktop_icons.py +++ b/frappe/patches/v6_24/sync_desktop_icons.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json from frappe.desk.doctype.desktop_icon.desktop_icon import sync_from_app, get_user_copy diff --git a/frappe/patches/v7_0/add_communication_in_doc.py b/frappe/patches/v7_0/add_communication_in_doc.py index 1ec31be72d..92120634ef 100644 --- a/frappe/patches/v7_0/add_communication_in_doc.py +++ b/frappe/patches/v7_0/add_communication_in_doc.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.core.doctype.communication.comment import update_comment_in_doc diff --git a/frappe/patches/v7_0/cleanup_list_settings.py b/frappe/patches/v7_0/cleanup_list_settings.py index dc918afb79..e03ff57406 100644 --- a/frappe/patches/v7_0/cleanup_list_settings.py +++ b/frappe/patches/v7_0/cleanup_list_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json def execute(): diff --git a/frappe/patches/v7_0/create_private_file_folder.py b/frappe/patches/v7_0/create_private_file_folder.py index 51e3d9f07b..bd26917a78 100644 --- a/frappe/patches/v7_0/create_private_file_folder.py +++ b/frappe/patches/v7_0/create_private_file_folder.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, os def execute(): diff --git a/frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py b/frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py index 269a8978d4..496af17cd2 100644 --- a/frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py +++ b/frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_0/re_route.py b/frappe/patches/v7_0/re_route.py index 46e4771855..cc36594ae8 100644 --- a/frappe/patches/v7_0/re_route.py +++ b/frappe/patches/v7_0/re_route.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.model.base_document import get_controller diff --git a/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py b/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py index 7be9aa6a72..9a7a756144 100644 --- a/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py +++ b/frappe/patches/v7_0/rename_bulk_email_to_email_queue.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py b/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py index 059792d68e..79061d383c 100644 --- a/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py +++ b/frappe/patches/v7_0/rename_newsletter_list_to_email_group.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_0/set_user_fullname.py b/frappe/patches/v7_0/set_user_fullname.py index f2ddf43b5a..a7c6670f45 100644 --- a/frappe/patches/v7_0/set_user_fullname.py +++ b/frappe/patches/v7_0/set_user_fullname.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_0/update_send_after_in_bulk_email.py b/frappe/patches/v7_0/update_send_after_in_bulk_email.py index 157b084255..1b08309b6a 100644 --- a/frappe/patches/v7_0/update_send_after_in_bulk_email.py +++ b/frappe/patches/v7_0/update_send_after_in_bulk_email.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils import now_datetime diff --git a/frappe/patches/v7_1/rename_chinese_language_codes.py b/frappe/patches/v7_1/rename_chinese_language_codes.py index 858246faa2..1ed25a4959 100644 --- a/frappe/patches/v7_1/rename_chinese_language_codes.py +++ b/frappe/patches/v7_1/rename_chinese_language_codes.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py b/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py index fdc6b0a44f..4d1a39538f 100644 --- a/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py +++ b/frappe/patches/v7_1/rename_scheduler_log_to_error_log.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_1/sync_language_doctype.py b/frappe/patches/v7_1/sync_language_doctype.py index a3eda183b2..83d1a4f5a6 100644 --- a/frappe/patches/v7_1/sync_language_doctype.py +++ b/frappe/patches/v7_1/sync_language_doctype.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.translate import get_lang_dict diff --git a/frappe/patches/v7_2/fix_email_queue_recipient.py b/frappe/patches/v7_2/fix_email_queue_recipient.py index 89aca69c91..645b17b5c9 100644 --- a/frappe/patches/v7_2/fix_email_queue_recipient.py +++ b/frappe/patches/v7_2/fix_email_queue_recipient.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_2/merge_knowledge_base.py b/frappe/patches/v7_2/merge_knowledge_base.py index 2eb52acfd6..81ff98230b 100644 --- a/frappe/patches/v7_2/merge_knowledge_base.py +++ b/frappe/patches/v7_2/merge_knowledge_base.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.patches.v7_0.re_route import update_routes diff --git a/frappe/patches/v7_2/remove_in_filter.py b/frappe/patches/v7_2/remove_in_filter.py index dcd62a45e7..36556d7c13 100644 --- a/frappe/patches/v7_2/remove_in_filter.py +++ b/frappe/patches/v7_2/remove_in_filter.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_2/set_doctype_engine.py b/frappe/patches/v7_2/set_doctype_engine.py index fa914003f3..3a5cc384a2 100644 --- a/frappe/patches/v7_2/set_doctype_engine.py +++ b/frappe/patches/v7_2/set_doctype_engine.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_2/set_in_standard_filter_property.py b/frappe/patches/v7_2/set_in_standard_filter_property.py index 9f0de7ebf2..1379ffd431 100644 --- a/frappe/patches/v7_2/set_in_standard_filter_property.py +++ b/frappe/patches/v7_2/set_in_standard_filter_property.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_2/setup_custom_perms.py b/frappe/patches/v7_2/setup_custom_perms.py index f057e7aa0d..1b3b86236c 100644 --- a/frappe/patches/v7_2/setup_custom_perms.py +++ b/frappe/patches/v7_2/setup_custom_perms.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.permissions import setup_custom_perms from frappe.core.page.permission_manager.permission_manager import get_standard_permissions diff --git a/frappe/patches/v7_2/setup_ldap_config.py b/frappe/patches/v7_2/setup_ldap_config.py index 670474dc64..31dd8ca6fe 100644 --- a/frappe/patches/v7_2/setup_ldap_config.py +++ b/frappe/patches/v7_2/setup_ldap_config.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils import cint diff --git a/frappe/patches/v7_2/update_communications.py b/frappe/patches/v7_2/update_communications.py index b7a1b962f8..98c729ae41 100644 --- a/frappe/patches/v7_2/update_communications.py +++ b/frappe/patches/v7_2/update_communications.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v7_2/update_feedback_request.py b/frappe/patches/v7_2/update_feedback_request.py index 37e77d9b15..68814e7a58 100644 --- a/frappe/patches/v7_2/update_feedback_request.py +++ b/frappe/patches/v7_2/update_feedback_request.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/deprecate_integration_broker.py b/frappe/patches/v8_0/deprecate_integration_broker.py index b8201f1ca1..ad1a7d9571 100644 --- a/frappe/patches/v8_0/deprecate_integration_broker.py +++ b/frappe/patches/v8_0/deprecate_integration_broker.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.integrations.utils import create_payment_gateway diff --git a/frappe/patches/v8_0/drop_in_dialog.py b/frappe/patches/v8_0/drop_in_dialog.py index b3ba15764f..231d757f26 100644 --- a/frappe/patches/v8_0/drop_in_dialog.py +++ b/frappe/patches/v8_0/drop_in_dialog.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/drop_is_custom_from_docperm.py b/frappe/patches/v8_0/drop_is_custom_from_docperm.py index c4e457d813..4530dcd2e0 100644 --- a/frappe/patches/v8_0/drop_is_custom_from_docperm.py +++ b/frappe/patches/v8_0/drop_is_custom_from_docperm.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/install_new_build_system_requirements.py b/frappe/patches/v8_0/install_new_build_system_requirements.py index 3d8843213a..536c2fcfb3 100644 --- a/frappe/patches/v8_0/install_new_build_system_requirements.py +++ b/frappe/patches/v8_0/install_new_build_system_requirements.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals from subprocess import Popen, call, PIPE def execute(): diff --git a/frappe/patches/v8_0/rename_listsettings_to_usersettings.py b/frappe/patches/v8_0/rename_listsettings_to_usersettings.py index f17e925cc3..584e4a1111 100644 --- a/frappe/patches/v8_0/rename_listsettings_to_usersettings.py +++ b/frappe/patches/v8_0/rename_listsettings_to_usersettings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals from frappe.model.utils.user_settings import update_user_settings import frappe, json from six import iteritems diff --git a/frappe/patches/v8_0/rename_print_to_printing.py b/frappe/patches/v8_0/rename_print_to_printing.py index 171de9b59b..ecdbc3f7be 100644 --- a/frappe/patches/v8_0/rename_print_to_printing.py +++ b/frappe/patches/v8_0/rename_print_to_printing.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/set_allow_traceback.py b/frappe/patches/v8_0/set_allow_traceback.py index 2b1e91a7ae..3eceb3e29c 100644 --- a/frappe/patches/v8_0/set_allow_traceback.py +++ b/frappe/patches/v8_0/set_allow_traceback.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/setup_email_inbox.py b/frappe/patches/v8_0/setup_email_inbox.py index cb4156e935..8cd8b28116 100644 --- a/frappe/patches/v8_0/setup_email_inbox.py +++ b/frappe/patches/v8_0/setup_email_inbox.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe, json from frappe.core.doctype.user.user import ask_pass_update, setup_user_email_inbox diff --git a/frappe/patches/v8_0/update_global_search_table.py b/frappe/patches/v8_0/update_global_search_table.py index cb788da1e0..3c0a70155b 100644 --- a/frappe/patches/v8_0/update_global_search_table.py +++ b/frappe/patches/v8_0/update_global_search_table.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/update_published_in_global_search.py b/frappe/patches/v8_0/update_published_in_global_search.py index 0a6595319a..a378f24732 100644 --- a/frappe/patches/v8_0/update_published_in_global_search.py +++ b/frappe/patches/v8_0/update_published_in_global_search.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_0/update_records_in_global_search.py b/frappe/patches/v8_0/update_records_in_global_search.py index 4792ebec5a..dafa1e76d3 100644 --- a/frappe/patches/v8_0/update_records_in_global_search.py +++ b/frappe/patches/v8_0/update_records_in_global_search.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils.global_search import get_doctypes_with_global_search, rebuild_for_doctype from frappe.utils import update_progress_bar diff --git a/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py b/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py index 6b0b731978..92b54edfd4 100644 --- a/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py +++ b/frappe/patches/v8_1/delete_custom_docperm_if_doctype_not_exists.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v8_x/update_user_permission.py b/frappe/patches/v8_x/update_user_permission.py index 0f8045f48d..693b87c974 100644 --- a/frappe/patches/v8_x/update_user_permission.py +++ b/frappe/patches/v8_x/update_user_permission.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v9_1/move_feed_to_activity_log.py b/frappe/patches/v9_1/move_feed_to_activity_log.py index 2d35e1e908..db46b4e419 100644 --- a/frappe/patches/v9_1/move_feed_to_activity_log.py +++ b/frappe/patches/v9_1/move_feed_to_activity_log.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe from frappe.utils.background_jobs import enqueue diff --git a/frappe/patches/v9_1/resave_domain_settings.py b/frappe/patches/v9_1/resave_domain_settings.py index 63ad68751d..1e54ad3aa5 100644 --- a/frappe/patches/v9_1/resave_domain_settings.py +++ b/frappe/patches/v9_1/resave_domain_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/patches/v9_1/revert_domain_settings.py b/frappe/patches/v9_1/revert_domain_settings.py index 1682651a51..a14b48dae6 100644 --- a/frappe/patches/v9_1/revert_domain_settings.py +++ b/frappe/patches/v9_1/revert_domain_settings.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import frappe def execute(): diff --git a/frappe/printing/doctype/print_settings/print_settings.py b/frappe/printing/doctype/print_settings/print_settings.py index 8043130358..2758f0aa9c 100644 --- a/frappe/printing/doctype/print_settings/print_settings.py +++ b/frappe/printing/doctype/print_settings/print_settings.py @@ -18,7 +18,7 @@ class PrintSettings(Document): printer_list = [] try: import cups - except ModuleNotFoundError: + except ImportError: frappe.throw("You need to install pycups to use this feature!") return try: diff --git a/frappe/printing/page/print_format_builder/print_format_builder_section.html b/frappe/printing/page/print_format_builder/print_format_builder_section.html index f5a96faede..d08a7ca5b2 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder_section.html +++ b/frappe/printing/page/print_format_builder/print_format_builder_section.html @@ -1,4 +1,4 @@ -