From 3e8ca0dd8d1b7279cba6eab85b40da601d442dcb Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 27 Sep 2019 13:08:33 +0530 Subject: [PATCH 01/28] feat: Added 'Allow Import (via Data Import Tool)' checkbox in Customize Form Checkbox will let users enable DocTypes in Data Import Document Type Link Field in Data Import will fetch Importable DocTypes from meta --- frappe/custom/doctype/customize_form/customize_form.json | 9 ++++++++- frappe/custom/doctype/customize_form/customize_form.py | 3 ++- frappe/utils/user.py | 7 +++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frappe/custom/doctype/customize_form/customize_form.json b/frappe/custom/doctype/customize_form/customize_form.json index d4b6bc6352..539051e4ef 100644 --- a/frappe/custom/doctype/customize_form/customize_form.json +++ b/frappe/custom/doctype/customize_form/customize_form.json @@ -18,6 +18,7 @@ "track_changes", "track_views", "allow_auto_repeat", + "allow_import", "image_view", "column_break_5", "title_field", @@ -167,13 +168,19 @@ "fieldname": "allow_auto_repeat", "fieldtype": "Check", "label": "Allow Auto Repeat" + }, + { + "default": "0", + "fieldname": "allow_import", + "fieldtype": "Check", + "label": "Allow Import (via Data Import Tool)" } ], "hide_toolbar": 1, "icon": "fa fa-glass", "idx": 1, "issingle": 1, - "modified": "2019-07-01 22:50:50.372465", + "modified": "2019-09-27 00:01:19.609039", "modified_by": "Administrator", "module": "Custom", "name": "Customize Form", diff --git a/frappe/custom/doctype/customize_form/customize_form.py b/frappe/custom/doctype/customize_form/customize_form.py index 425191c4eb..b851d40b83 100644 --- a/frappe/custom/doctype/customize_form/customize_form.py +++ b/frappe/custom/doctype/customize_form/customize_form.py @@ -30,7 +30,8 @@ doctype_properties = { 'max_attachments': 'Int', 'track_changes': 'Check', 'track_views': 'Check', - 'allow_auto_repeat': 'Check' + 'allow_auto_repeat': 'Check', + 'allow_import': 'Check' } docfield_properties = { diff --git a/frappe/utils/user.py b/frappe/utils/user.py index 1446b9749f..ec899d5c47 100755 --- a/frappe/utils/user.py +++ b/frappe/utils/user.py @@ -157,8 +157,11 @@ class UserPermissions: self.can_read.remove(dt) if "System Manager" in self.get_roles(): - self.can_import = list(filter(lambda d: d in self.can_create, - frappe.db.sql_list("""select name from `tabDocType` where allow_import = 1"""))) + docs = [x['name'] for x in frappe.get_all("DocType", "name")] + frappe.clear_cache() + for docname in docs: + if frappe.get_meta(docname).allow_import == 1: + self.can_import.append(docname) def get_defaults(self): import frappe.defaults From a47d1b3e57260d2276be5119c37edb37b11ee031 Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Wed, 9 Oct 2019 11:30:15 +0530 Subject: [PATCH 02/28] fix(hooks): check for updates daily instead of weekly --- frappe/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/hooks.py b/frappe/hooks.py index fd7c940fa4..aeba3c7445 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -190,13 +190,13 @@ scheduler_events = { ], "daily_long": [ "frappe.integrations.doctype.dropbox_settings.dropbox_settings.take_backups_daily", + "frappe.utils.change_log.check_for_update", "frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_daily", "frappe.integrations.doctype.google_drive.google_drive.daily_backup" ], "weekly_long": [ "frappe.integrations.doctype.dropbox_settings.dropbox_settings.take_backups_weekly", "frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_weekly", - "frappe.utils.change_log.check_for_update", "frappe.desk.doctype.route_history.route_history.flush_old_route_records", "frappe.desk.form.document_follow.send_weekly_updates", "frappe.social.doctype.energy_point_log.energy_point_log.send_weekly_summary", From e08779c362536c4af1597de87a81b5522bcc5d01 Mon Sep 17 00:00:00 2001 From: marination Date: Wed, 9 Oct 2019 12:36:35 +0530 Subject: [PATCH 03/28] fix: Importable docs via Customize Form set in redis cache can_import list is set in redis cache Data Import's set query will fetch from cache ad update list --- .../core/doctype/data_import/data_import.js | 23 +++++++++++-------- .../core/doctype/data_import/data_import.py | 5 ++++ .../customize_form/customize_form.json | 2 +- frappe/utils/user.py | 6 ++--- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/frappe/core/doctype/data_import/data_import.js b/frappe/core/doctype/data_import/data_import.js index eeaa5ac34e..c5bd4e99c9 100644 --- a/frappe/core/doctype/data_import/data_import.js +++ b/frappe/core/doctype/data_import/data_import.js @@ -7,15 +7,20 @@ frappe.ui.form.on('Data Import', { frm.set_value("action", ""); } - frm.set_query("reference_doctype", function() { - return { - "filters": { - "issingle": 0, - "istable": 0, - "name": ['in', frappe.boot.user.can_import] - } - }; - }); + frappe.call({ + method: "frappe.core.doctype.data_import.data_import.get_importable_doc", + callback: function (r) { + frm.set_query("reference_doctype", function () { + return { + "filters": { + "issingle": 0, + "istable": 0, + "name": ['in', r.message] + } + }; + }); + } + }), // should never check public frm.fields_dict["import_file"].df.is_private = 1; diff --git a/frappe/core/doctype/data_import/data_import.py b/frappe/core/doctype/data_import/data_import.py index 5500f1c617..80f8553121 100644 --- a/frappe/core/doctype/data_import/data_import.py +++ b/frappe/core/doctype/data_import/data_import.py @@ -29,6 +29,11 @@ class DataImport(Document): upload(data_import_doc=self, from_data_import="Yes", validate_template=True) +@frappe.whitelist() +def get_importable_doc(): + import_lst = frappe.cache().hget("can_import", frappe.session.user) + return import_lst + @frappe.whitelist() def import_data(data_import): frappe.db.set_value("Data Import", data_import, "import_status", "In Progress", update_modified=False) diff --git a/frappe/custom/doctype/customize_form/customize_form.json b/frappe/custom/doctype/customize_form/customize_form.json index 539051e4ef..0b1df62f9d 100644 --- a/frappe/custom/doctype/customize_form/customize_form.json +++ b/frappe/custom/doctype/customize_form/customize_form.json @@ -180,7 +180,7 @@ "icon": "fa fa-glass", "idx": 1, "issingle": 1, - "modified": "2019-09-27 00:01:19.609039", + "modified": "2019-10-08 11:16:36.698006", "modified_by": "Administrator", "module": "Custom", "name": "Customize Form", diff --git a/frappe/utils/user.py b/frappe/utils/user.py index ec899d5c47..0959316ee8 100755 --- a/frappe/utils/user.py +++ b/frappe/utils/user.py @@ -157,11 +157,11 @@ class UserPermissions: self.can_read.remove(dt) if "System Manager" in self.get_roles(): - docs = [x['name'] for x in frappe.get_all("DocType", "name")] - frappe.clear_cache() + docs = [x["name"] for x in frappe.get_all("DocType", "name")] for docname in docs: - if frappe.get_meta(docname).allow_import == 1: + if frappe.get_meta(docname, cached=False).allow_import == 1: self.can_import.append(docname) + frappe.cache().hset("can_import", frappe.session.user, self.can_import) def get_defaults(self): import frappe.defaults From 5787ea3c5a48147b4c26848f9ed80222d1458457 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 9 Oct 2019 13:02:53 +0530 Subject: [PATCH 04/28] fix: Provision to ignore disabled link validations in a doctype --- frappe/model/base_document.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py index 27f0f56ebd..2e386e6c26 100644 --- a/frappe/model/base_document.py +++ b/frappe/model/base_document.py @@ -464,7 +464,7 @@ class BaseDocument(object): or frappe.flags.in_patch ): disabled = frappe.get_value(doctype, self.get(df.fieldname), 'disabled') - if disabled: + if disabled and (not self.flags.ignore_disabled): frappe.throw(_("{0} is disabled").format(frappe.bold(self.get(df.fieldname)))) else: doctype = self.get(df.options) From d97689f33a9a731781e098cca58c65543d8183fc Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Wed, 9 Oct 2019 14:26:26 +0530 Subject: [PATCH 05/28] fix(email_domian): set domain_name as non_unique --- frappe/email/doctype/email_domain/email_domain.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/email/doctype/email_domain/email_domain.json b/frappe/email/doctype/email_domain/email_domain.json index 4e3499e4bd..677bf876aa 100644 --- a/frappe/email/doctype/email_domain/email_domain.json +++ b/frappe/email/doctype/email_domain/email_domain.json @@ -30,7 +30,7 @@ "fieldtype": "Data", "label": "domain name", "read_only": 1, - "unique": 1 + "unique": 0 }, { "fieldname": "email_id", @@ -109,7 +109,7 @@ } ], "icon": "icon-inbox", - "modified": "2019-08-31 17:56:48.834704", + "modified": "2019-10-09 17:56:48.834704", "modified_by": "Administrator", "module": "Email", "name": "Email Domain", @@ -127,4 +127,4 @@ ], "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} From dea1f3ca501473ce070604a7c88b3988d499fd75 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 10 Oct 2019 13:58:57 +0530 Subject: [PATCH 06/28] fix: Nonetype object has no attribute options --- frappe/core/doctype/communication/communication.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/communication/communication.json b/frappe/core/doctype/communication/communication.json index 909999b0bd..5e34804b93 100644 --- a/frappe/core/doctype/communication/communication.json +++ b/frappe/core/doctype/communication/communication.json @@ -383,7 +383,7 @@ ], "icon": "fa fa-comment", "idx": 1, - "modified": "2019-09-05 14:22:27.664645", + "modified": "2019-10-09 14:22:27.664645", "modified_by": "Administrator", "module": "Core", "name": "Communication", From 3ff3e71d343cc7aaa761b39b2c9fa28aed95d8e0 Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Thu, 10 Oct 2019 15:08:40 +0530 Subject: [PATCH 07/28] chore: make communication list exception helpful * fixes infinite error recursion caused by window.history.back(); * throw an actually useful message instead of using msgprint Signed-off-by: Chinmay D. Pai --- frappe/public/js/frappe/views/inbox/inbox_view.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/views/inbox/inbox_view.js b/frappe/public/js/frappe/views/inbox/inbox_view.js index 72a28c6489..2b35d38683 100644 --- a/frappe/public/js/frappe/views/inbox/inbox_view.js +++ b/frappe/public/js/frappe/views/inbox/inbox_view.js @@ -17,9 +17,7 @@ frappe.views.InboxView = class InboxView extends frappe.views.ListView { frappe.set_route("List", "Communication", "Inbox", email_account); return true; } else if (!route[3] || (route[3] !== "All Accounts" && !is_valid(route[3]))) { - frappe.msgprint(__('Invalid Email Account')); - window.history.back(); - return true; + frappe.throw(__('No email account associated with the User. Please add an account under User > Email Inbox.')); } return false; From bad90cf6ef037f1585a404743777d0a1b887cc58 Mon Sep 17 00:00:00 2001 From: gavin Date: Thu, 10 Oct 2019 15:30:28 +0530 Subject: [PATCH 08/28] chore: updated GitHub contributing templates (#8565) --- .github/CONTRIBUTING.md | 8 ++-- .github/ISSUE_TEMPLATE/bug_report.md | 47 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 28 +++++++++++ .../question-about-using-frappe.md | 19 ++++++++ .github/PULL_REQUEST_TEMPLATE.md | 34 +++++++++++++- 5 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/question-about-using-frappe.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 511b682f37..8f300706b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,12 +1,12 @@ ### Introduction (first timers) -Thank you for your interest in raising an Issue with ERPNext. An Issue could mean a bug report or a request for a missing feature. By raising a bug report, you are contributing to the development of ERPNext and this is the first step of participating in the community. Bug reports are very helpful for developers as they quickly fix the issue before other users start facing it. +Thank you for your interest in raising an Issue with the Frappe Framework. An Issue could mean a bug report or a request for a missing feature. By raising a bug report, you are contributing to the development of the Frappe Framework and this is the first step of participating in the community. Bug reports are very helpful for developers as they quickly fix the issue before other users start facing it. Feature requests are also a great way to take the product forward. New ideas can come in any user scenario and the issue list also acts a roadmap of future features. When you are raising an Issue, you should keep a few things in mind. Remember that the developer does not have access to your machine so you must give all the information you can while raising an Issue. If you are suggesting a feature, you should be very clear about what you want. -The Issue list is not the right place to ask a question or start a general discussion. If you want to do that , then the right place is the forum [https://discuss.erpnext.com](https://discuss.erpnext.com). +The Issue list is not the right place to ask a question or start a general discussion. If you want to do that , then the right place is the forum [https://discuss.frappe.io](https://discuss.frappe.io). ### Reply and Closing Policy @@ -15,8 +15,8 @@ If your issue is not clear or does not meet the guidelines, then it will be clos ### General Issue Guidelines 1. **Search existing Issues:** Before raising a Issue, search if it has been raised before. Maybe add a 👍 or give additional help by creating a mockup if it is not already created. -1. **Report each issue separately:** Don't club multiple, unreleated issues in one note. -1. **Brief:** Please don't include long explanations. Use screenshots and bullet points instead of descriptive paragraphs. +2. **Report each issue separately:** Don't club multiple, unreleated issues in one note. +3. **Brief:** Please don't include long explanations. Use screenshots and bullet points instead of descriptive paragraphs. ### Bug Report Guidelines diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..62897d048d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,47 @@ +--- +name: Bug report +about: Report a bug encountered while using the Frappe Framework + +--- + + + +## Description of the issue + +## Context information (for bug reports) + +**Output of `bench version`** +``` +(paste here) +``` + +## Steps to reproduce the issue + +1. +2. +3. + +### Observed result + +### Expected result + +### Stacktrace / full error message + +``` +(paste here) +``` + +## Additional information + +OS version / distribution, `Frappe` install method, etc. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..4c9b9e6fb5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,28 @@ +--- +name: Feature request +about: Suggest an idea to improve Frappe + +--- + + + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question-about-using-frappe.md b/.github/ISSUE_TEMPLATE/question-about-using-frappe.md new file mode 100644 index 0000000000..74f9c5279f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question-about-using-frappe.md @@ -0,0 +1,19 @@ +--- +name: Question about using Frappe/Frappe Apps +about: This is not the appropriate channel + +--- + +Please post on our forums: + +for questions about using the `Frappe Framework`: https://discuss.frappe.io + +for questions about using `ERPNext`: https://discuss.erpnext.com + +for questions about using `bench`, probably the best place to start is the [bench repo](https://github.com/frappe/bench) + +For documentation issues, use the [Frappe Framework Documentation](https://frappe.io/docs/user/en) or the [developer cheetsheet](https://github.com/frappe/frappe/wiki/Developer-Cheatsheet) + +For a slightly outdated yet informative developer guide: https://www.youtube.com/playlist?list=PL3lFfCEoMxvzHtsZHFJ4T3n5yMM3nGJ1W + +> **Posts that are not bug reports or feature requests will not be addressed on this issue tracker.** \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 73b92062d2..8fc5248b7b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1 +1,33 @@ -Please read the [Pull Request Checklist](https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist) to ensure you have everything that is needed to get your contribution merged. \ No newline at end of file + + +> Please provide enough information so that others can review your pull request: + + + +> Explain the **details** for making this change. What existing problem does the pull request solve? + + + +> Screenshots/GIFs + + From 86245cc890f5fb865facb95a7b4e6456b7780a66 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Thu, 10 Oct 2019 21:58:59 +0530 Subject: [PATCH 09/28] fix: autoset recipient if email_field in doc --- frappe/public/js/frappe/views/communication.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index adc440469a..1960520e6b 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -127,9 +127,9 @@ frappe.views.CommunicationComposer = Class.extend({ this.setup_last_edited_communication(); this.setup_email_template(); - this.dialog.fields_dict.recipients.set_value(this.recipients || ''); - this.dialog.fields_dict.cc.set_value(this.cc || ''); - this.dialog.fields_dict.bcc.set_value(this.bcc || ''); + this.dialog.set_value("recipients", this.recipients || ''); + this.dialog.set_value("cc", this.cc || ''); + this.dialog.set_value("bcc", this.bcc || ''); if(this.dialog.fields_dict.sender) { this.dialog.fields_dict.sender.set_value(this.sender || ''); @@ -181,6 +181,10 @@ frappe.views.CommunicationComposer = Class.extend({ } } } + + if (!this.recipients) { + this.recipients = this.frm.doc[this.frm.email_field]; + } }, setup_email_template: function() { @@ -690,6 +694,7 @@ frappe.views.CommunicationComposer = Class.extend({ } fields.content.set_value(content); }, + html2text: function(html) { // convert HTML to text and try and preserve whitespace var d = document.createElement( 'div' ); From 2ace6739d74c47d92872b39cbfc827c09ebc3ca3 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Thu, 10 Oct 2019 22:06:59 +0530 Subject: [PATCH 10/28] fix: rename fields --- frappe/contacts/doctype/contact/contact.json | 4 ++-- frappe/contacts/doctype/contact/contact.py | 6 ------ frappe/core/doctype/dynamic_link/dynamic_link.json | 4 ++-- .../global_search_settings/global_search_settings.json | 4 ++-- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/frappe/contacts/doctype/contact/contact.json b/frappe/contacts/doctype/contact/contact.json index 7bc13accf8..7dd5aad4ce 100644 --- a/frappe/contacts/doctype/contact/contact.json +++ b/frappe/contacts/doctype/contact/contact.json @@ -193,7 +193,7 @@ { "fieldname": "phone_nos", "fieldtype": "Table", - "label": "Numbers", + "label": "Contact Numbers", "options": "Contact Phone" }, { @@ -245,7 +245,7 @@ "icon": "fa fa-user", "idx": 1, "image_field": "image", - "modified": "2019-09-24 17:48:26.790985", + "modified": "2019-10-10 22:04:41.070479", "modified_by": "Administrator", "module": "Contacts", "name": "Contact", diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index f851e19b46..b9239dc1f6 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -32,7 +32,6 @@ class Contact(Document): self.set_primary_email() self.set_primary("phone") self.set_primary("mobile_no") - self.check_if_primary_phone_and_mobile_no_same() self.set_user() @@ -119,11 +118,6 @@ class Contact(Document): setattr(self, fieldname, d.phone) break - def check_if_primary_phone_and_mobile_no_same(self): - if self.phone and self.mobile_no and self.phone == self.mobile_no: - number = frappe.bold(self.phone) - frappe.throw(_("Number {0} cannot be set as primary for Phone as well as Mobile No.").format(number)) - def get_default_contact(doctype, name): '''Returns default contact for the given doctype, name''' out = frappe.db.sql('''select parent, diff --git a/frappe/core/doctype/dynamic_link/dynamic_link.json b/frappe/core/doctype/dynamic_link/dynamic_link.json index abc47df100..b99f77f139 100644 --- a/frappe/core/doctype/dynamic_link/dynamic_link.json +++ b/frappe/core/doctype/dynamic_link/dynamic_link.json @@ -13,7 +13,7 @@ "fieldname": "link_doctype", "fieldtype": "Link", "in_list_view": 1, - "label": "Link DocType", + "label": "Link Document Type", "options": "DocType", "reqd": 1 }, @@ -34,7 +34,7 @@ } ], "istable": 1, - "modified": "2019-05-16 19:54:31.400026", + "modified": "2019-10-10 22:05:54.736093", "modified_by": "Administrator", "module": "Core", "name": "Dynamic Link", diff --git a/frappe/desk/doctype/global_search_settings/global_search_settings.json b/frappe/desk/doctype/global_search_settings/global_search_settings.json index e0b4b11d05..6fa25f72b7 100644 --- a/frappe/desk/doctype/global_search_settings/global_search_settings.json +++ b/frappe/desk/doctype/global_search_settings/global_search_settings.json @@ -10,12 +10,12 @@ { "fieldname": "allowed_in_global_search", "fieldtype": "Table", - "label": "Document Types", + "label": "Search Priorities", "options": "Global Search DocType" } ], "issingle": 1, - "modified": "2019-09-18 18:00:17.388486", + "modified": "2019-10-10 22:05:02.692689", "modified_by": "Administrator", "module": "Desk", "name": "Global Search Settings", From e1a7112d861be08458d5f07e52ea74f7423635cc Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Thu, 10 Oct 2019 23:33:11 +0530 Subject: [PATCH 11/28] fix: test cases for contacts --- .../contacts/doctype/contact/test_contact.py | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/frappe/contacts/doctype/contact/test_contact.py b/frappe/contacts/doctype/contact/test_contact.py index 2e6f9ad422..4929873dc4 100644 --- a/frappe/contacts/doctype/contact/test_contact.py +++ b/frappe/contacts/doctype/contact/test_contact.py @@ -33,37 +33,6 @@ class TestContact(unittest.TestCase): self.assertEqual(contact.phone, "+91 0000000002") self.assertEqual(contact.mobile_no, "+91 0000000003") - def test_same_phone_and_mobile(self): - phones = [ - {"phone": "+91 0000000000", "is_primary_phone": 1, "is_primary_mobile_no": 1}, - ] - contact = create_contact("Phone", "Mr", phones=phones, save=False) - self.assertRaises(ValidationError, contact.save) - - def test_no_primary_set(self): - emails = [ - {"email": "test1@example.com", "is_primary": 0}, - {"email": "test2@example.com", "is_primary": 0}, - {"email": "test3@example.com", "is_primary": 0}, - {"email": "test4@example.com", "is_primary": 0}, - {"email": "test5@example.com", "is_primary": 0}, - ] - phones = [ - {"phone": "+91 0000000000", "is_primary_phone": 0, "is_primary_mobile_no": 0}, - {"phone": "+91 0000000001", "is_primary_phone": 0, "is_primary_mobile_no": 0}, - {"phone": "+91 0000000002", "is_primary_phone": 1, "is_primary_mobile_no": 1}, - {"phone": "+91 0000000003", "is_primary_phone": 0, "is_primary_mobile_no": 0}, - ] - - contact_email = create_contact("Default", "Mr", emails=emails, phones=phones, save=False) - contact_phone = create_contact("Default", "Mr", emails=emails, phones=phones, save=False) - - # No default set for emails if many emails are passed as params - self.assertRaises(ValidationError, contact_email.save) - - # No default set for phones if many phones are passed as params - self.assertRaises(ValidationError, contact_phone.save) - def create_contact(name, salutation, emails=None, phones=None, save=True): doc = frappe.get_doc({ "doctype": "Contact", From cc479144d9c7dd20f6bfbc44f6a47f575806818e Mon Sep 17 00:00:00 2001 From: Himanshu Date: Fri, 11 Oct 2019 00:33:23 +0530 Subject: [PATCH 12/28] =?UTF-8?q?fix(patch):=20remove=20quotes=20from=20ta?= =?UTF-8?q?gs=20due=20to=20db.escape=20and=20fix=20pr=E2=80=A6=20(#8566)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frappe/patches/v12_0/setup_tags.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frappe/patches/v12_0/setup_tags.py b/frappe/patches/v12_0/setup_tags.py index 33ea39c898..cd50b0d505 100644 --- a/frappe/patches/v12_0/setup_tags.py +++ b/frappe/patches/v12_0/setup_tags.py @@ -21,11 +21,10 @@ def execute(): if not tag: continue - escaped_tag = frappe.db.escape(tag.strip()) - tag_list.append((escaped_tag, time, time, 'Administrator')) + tag_list.append((tag.strip(), time, time, 'Administrator')) - tag_link_name = frappe.generate_hash(dt_tags.name + escaped_tag, 10), - tag_links.append((tag_link_name, doctype.name, dt_tags.name, escaped_tag, time, time, 'Administrator')) + tag_link_name = frappe.generate_hash(dt_tags.name + tag.strip() + doctype.name, 10), + tag_links.append((tag_link_name, doctype.name, dt_tags.name, tag.strip(), time, time, 'Administrator')) - frappe.db.bulk_insert("Tag", fields=["name", "creation", "modified", "modified_by"], values=tag_list) - frappe.db.bulk_insert("Tag Link", fields=["name", "document_type", "document_name", "tag", "creation", "modified", "modified_by"], values=tag_links) \ No newline at end of file + frappe.db.bulk_insert("Tag", fields=["name", "creation", "modified", "modified_by"], values=set(tag_list)) + frappe.db.bulk_insert("Tag Link", fields=["name", "document_type", "document_name", "tag", "creation", "modified", "modified_by"], values=set(tag_links)) \ No newline at end of file From 5e6ce7d2eb0fc64326e169a62dea4dba85bff31e Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Fri, 11 Oct 2019 15:07:26 +0530 Subject: [PATCH 13/28] fix: TypeError: 'NoneType' object is not iterable --- frappe/integrations/doctype/google_calendar/google_calendar.py | 2 +- frappe/integrations/doctype/google_contacts/google_contacts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/integrations/doctype/google_calendar/google_calendar.py b/frappe/integrations/doctype/google_calendar/google_calendar.py index d6ba82ed5a..fa2eea6ce1 100644 --- a/frappe/integrations/doctype/google_calendar/google_calendar.py +++ b/frappe/integrations/doctype/google_calendar/google_calendar.py @@ -220,7 +220,7 @@ def sync_events_from_google_calendar(g_calendar, method=None, page_length=10): except HttpError as err: frappe.throw(_("Google Calendar - Could not fetch event from Google Calendar, error code {0}.").format(err.resp.status)) - for event in events.get("items"): + for event in events.get("items", []): results.append(event) if not events.get("nextPageToken"): diff --git a/frappe/integrations/doctype/google_contacts/google_contacts.py b/frappe/integrations/doctype/google_contacts/google_contacts.py index 522a0e31a6..0e28c1306c 100644 --- a/frappe/integrations/doctype/google_contacts/google_contacts.py +++ b/frappe/integrations/doctype/google_contacts/google_contacts.py @@ -155,7 +155,7 @@ def sync_contacts_from_google_contacts(g_contact): except HttpError as err: frappe.throw(_("Google Contacts - Could not sync contacts from Google Contacts {0}, error code {1}.").format(account.name, err.resp.status)) - for contact in contacts.get("connections"): + for contact in contacts.get("connections", []): results.append(contact) if not contacts.get("nextPageToken"): From 30c672039811e7790ef52f091d6fe1d38de56410 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Fri, 11 Oct 2019 16:03:24 +0530 Subject: [PATCH 14/28] fix(patch): check if contact already exists for user --- frappe/patches/v11_0/create_contact_for_user.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/patches/v11_0/create_contact_for_user.py b/frappe/patches/v11_0/create_contact_for_user.py index 8a9238572e..b4722ab3ae 100644 --- a/frappe/patches/v11_0/create_contact_for_user.py +++ b/frappe/patches/v11_0/create_contact_for_user.py @@ -17,6 +17,8 @@ def execute(): users = frappe.get_all('User', filters={"name": ('not in', 'Administrator, Guest')}, fields=["*"]) for user in users: + if frappe.db.exists("Contact", {"email_id": user.email}) or frappe.db.exists("Contact Email", {"email_id": user.email}): + continue if user.first_name: user.first_name = re.sub("[<>]+", '', frappe.safe_decode(user.first_name)) if user.last_name: From 106b7e995c6c2fd51fdec412964ab9dfa4e2e16c Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Fri, 11 Oct 2019 16:08:16 +0530 Subject: [PATCH 15/28] fix(patch): reload prepared report doctype --- frappe/patches/v11_0/delete_all_prepared_reports.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/patches/v11_0/delete_all_prepared_reports.py b/frappe/patches/v11_0/delete_all_prepared_reports.py index 10bc049895..de36db66af 100644 --- a/frappe/patches/v11_0/delete_all_prepared_reports.py +++ b/frappe/patches/v11_0/delete_all_prepared_reports.py @@ -3,6 +3,7 @@ import frappe def execute(): if frappe.db.table_exists('Prepared Report'): + frappe.reload_doc("core", "doctype", "prepared_doctype") prepared_reports = frappe.get_all("Prepared Report") for report in prepared_reports: frappe.delete_doc("Prepared Report", report.name) From 30f30d57ffa7973827af3e38fcb1d9862d278eea Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 9 Oct 2019 14:47:00 +0530 Subject: [PATCH 16/28] fix: notification is not working if recipients is not set and cc is set --- frappe/email/doctype/notification/notification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py index 6ae4243775..d40f64b8bd 100644 --- a/frappe/email/doctype/notification/notification.py +++ b/frappe/email/doctype/notification/notification.py @@ -143,7 +143,7 @@ def get_context(context): attachments = self.get_attachment(doc) recipients, cc, bcc = self.get_list_of_recipients(doc, context) - if not recipients: + if not (recipients or cc or bcc): return sender = None if self.sender and self.sender_email: From a42283db994dda89be73b8ef16b3e97058898c29 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Sat, 12 Oct 2019 12:06:36 +0530 Subject: [PATCH 17/28] chore: updated Security policy and issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/question-about-using-frappe.md | 2 +- SECURITY.md | 7 +++++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 SECURITY.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 62897d048d..0935b4a73a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Report a bug encountered while using the Frappe Framework - +labels: bug ---