diff --git a/frappe/__init__.py b/frappe/__init__.py index 91e9a91ad6..bd1c78f4e6 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '9.2.11' +__version__ = '9.2.12' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/build.js b/frappe/build.js index be2be3bf7b..9f89f3b6d7 100644 --- a/frappe/build.js +++ b/frappe/build.js @@ -54,6 +54,11 @@ function watch() { console.log('file watching on *:', file_watcher_port); }); + if (process.env.CI) { + // don't watch inside CI + return; + } + compile_less().then(() => { build(); watch_less(function (filename) { diff --git a/frappe/core/doctype/domain/domain.py b/frappe/core/doctype/domain/domain.py index fed9f2360d..890ef87af6 100644 --- a/frappe/core/doctype/domain/domain.py +++ b/frappe/core/doctype/domain/domain.py @@ -31,6 +31,28 @@ class Domain(Document): # custom on_setup method frappe.get_attr(self.data.on_setup)() + def remove_domain(self): + '''Unset domain settings''' + self.setup_data() + for role_name in self.data.restricted_roles: + if frappe.db.exists('Role', role_name): + role = frappe.get_doc('Role', role_name) + role.disabled = 1 + role.save() + + if self.data.custom_fields: + for doctype in self.data.custom_fields: + custom_fields = self.data.custom_fields[doctype] + + # custom_fields can be a list or dict + if isinstance(custom_fields, dict): + custom_fields = [custom_fields] + + for custom_field_detail in custom_fields: + custom_field = frappe.get_doc('Custom Field', + dict(dt=doctype, fieldname=custom_field_detail.get('fieldname'))) + custom_field.delete() + def setup_roles(self): '''Enable roles that are restricted to this domain''' diff --git a/frappe/model/document.py b/frappe/model/document.py index 156546eebe..50f2170412 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -848,10 +848,10 @@ class Document(BaseDocument): - `before_update_after_submit` for **Update after Submit** Will also update title_field if set""" - self.set_title_field() - self.reset_seen() self.load_doc_before_save() + self.reset_seen() + if self.flags.ignore_validate: return @@ -866,6 +866,8 @@ class Document(BaseDocument): elif self._action=="update_after_submit": self.run_method("before_update_after_submit") + self.set_title_field() + def load_doc_before_save(self): '''Save load document from db before saving''' self._doc_before_save = None @@ -874,7 +876,6 @@ class Document(BaseDocument): or self.meta.get_set_only_once_fields())): self.get_doc_before_save() - def run_post_save_methods(self): """Run standard methods after `INSERT` or `UPDATE`. Standard Methods are: diff --git a/frappe/patches.txt b/frappe/patches.txt index e55931b031..e435669db4 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -196,4 +196,5 @@ frappe.patches.v8_5.patch_event_colors frappe.patches.v8_10.delete_static_web_page_from_global_search frappe.patches.v8_x.add_bgn_xaf_xof_currencies frappe.patches.v9_1.add_sms_sender_name_as_parameters -frappe.patches.v9_1.resave_domain_settings \ No newline at end of file +frappe.patches.v9_1.resave_domain_settings +frappe.patches.v9_1.revert_domain_settings \ No newline at end of file diff --git a/frappe/patches/v9_1/resave_domain_settings.py b/frappe/patches/v9_1/resave_domain_settings.py index 1e70bf885c..63ad68751d 100644 --- a/frappe/patches/v9_1/resave_domain_settings.py +++ b/frappe/patches/v9_1/resave_domain_settings.py @@ -1,10 +1,12 @@ import frappe def execute(): - domains = ['Education', 'Healthcare', 'Hospitality'] + domain_settings = frappe.get_doc('Domain Settings') + active_domains = [d.domain for d in domain_settings.active_domains] try: - for d in domains: - domain = frappe.get_doc('Domain', d) - domain.setup_domain() + for d in ('Education', 'Healthcare', 'Hospitality'): + if d in active_domains and frappe.db.exists('Domain', d): + domain = frappe.get_doc('Domain', d) + domain.setup_domain() except frappe.LinkValidationError: pass diff --git a/frappe/patches/v9_1/revert_domain_settings.py b/frappe/patches/v9_1/revert_domain_settings.py new file mode 100644 index 0000000000..1682651a51 --- /dev/null +++ b/frappe/patches/v9_1/revert_domain_settings.py @@ -0,0 +1,10 @@ +import frappe + +def execute(): + domain_settings = frappe.get_doc('Domain Settings') + active_domains = [d.domain for d in domain_settings.active_domains] + + for domain_name in ('Education', 'Healthcare', 'Hospitality'): + if frappe.db.exists('Domain', domain_name) and domain_name not in active_domains: + domain = frappe.get_doc('Domain', domain_name) + domain.remove_domain() \ No newline at end of file diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 88ada6c62f..a3a88c33cb 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -328,7 +328,10 @@ frappe.views.QueryReport = Class.extend({ me.trigger_refresh(); } } - df.ignore_link_validation = true; + + // This is specifically done true earlier due to some reason. Please update if anyone finds that. + // Done false as the api can be used in the script reports which can break due to invalid links + df.ignore_link_validation = false; } }); diff --git a/frappe/utils/print_format.py b/frappe/utils/print_format.py index 17d6eb2fde..b9d064f50f 100644 --- a/frappe/utils/print_format.py +++ b/frappe/utils/print_format.py @@ -42,8 +42,8 @@ def read_multi_pdf(output): return filedata @frappe.whitelist() -def download_pdf(doctype, name, format=None, doc=None): - html = frappe.get_print(doctype, name, format, doc=doc) +def download_pdf(doctype, name, format=None, doc=None, no_letterhead=0): + html = frappe.get_print(doctype, name, format, doc=doc, no_letterhead=no_letterhead) frappe.local.response.filename = "{name}.pdf".format(name=name.replace(" ", "-").replace("/", "-")) frappe.local.response.filecontent = get_pdf(html) frappe.local.response.type = "download" diff --git a/frappe/utils/selenium_testdriver.py b/frappe/utils/selenium_testdriver.py index 3f3d82fe43..d0ebb35c69 100644 --- a/frappe/utils/selenium_testdriver.py +++ b/frappe/utils/selenium_testdriver.py @@ -140,7 +140,7 @@ class TestDriver(object): for entry in self.driver.get_log('browser'): source, line_no, message = entry.get('message').split(' ', 2) - if message[0] in ('"', "'"): + if message and message[0] in ('"', "'"): # message is a quoted/escaped string message = literal_eval(message) diff --git a/requirements.txt b/requirements.txt index f3c2985cce..97cae9b188 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,7 @@ selenium -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit babel ipython -html2text +html2text==2016.9.19 email_reply_parser click num2words==0.5.5