diff --git a/frappe/__init__.py b/frappe/__init__.py index 77940bd124..c299fad536 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template -__version__ = '8.0.47' +__version__ = '8.0.48' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/desk/search.py b/frappe/desk/search.py index f9b767bcc7..13fc67349b 100644 --- a/frappe/desk/search.py +++ b/frappe/desk/search.py @@ -8,15 +8,15 @@ from frappe.utils import cstr, unique # this is called by the Link Field @frappe.whitelist() -def search_link(doctype, txt, query=None, filters=None, page_len=20, searchfield=None): - search_widget(doctype, txt, query, searchfield=searchfield, page_len=page_len, filters=filters) +def search_link(doctype, txt, query=None, filters=None, page_length=20, searchfield=None): + search_widget(doctype, txt, query, searchfield=searchfield, page_length=page_length, filters=filters) frappe.response['results'] = build_for_autosuggest(frappe.response["values"]) del frappe.response["values"] # this is called by the search box @frappe.whitelist() def search_widget(doctype, txt, query=None, searchfield=None, start=0, - page_len=10, filters=None, filter_fields=None, as_dict=False): + page_length=10, filters=None, filter_fields=None, as_dict=False): if isinstance(filters, basestring): import json filters = json.loads(filters) @@ -31,11 +31,11 @@ def search_widget(doctype, txt, query=None, searchfield=None, start=0, if query and query.split()[0].lower()!="select": # by method frappe.response["values"] = frappe.call(query, doctype, txt, - searchfield, start, page_len, filters, as_dict=as_dict) + searchfield, start, page_length, filters, as_dict=as_dict) elif not query and doctype in standard_queries: # from standard queries search_widget(doctype, txt, standard_queries[doctype][0], - searchfield, start, page_len, filters) + searchfield, start, page_length, filters) else: if query: frappe.throw("This query style is discontinued") @@ -95,7 +95,7 @@ def search_widget(doctype, txt, query=None, searchfield=None, start=0, values = frappe.get_list(doctype, filters=filters, fields=formatted_fields, or_filters = or_filters, limit_start = start, - limit_page_length=page_len, + limit_page_length=page_length, order_by=order_by, ignore_permissions = True if doctype == "DocType" else False, # for dynamic links as_list=not as_dict) diff --git a/frappe/email/doctype/email_alert/email_alert.py b/frappe/email/doctype/email_alert/email_alert.py index f9212cfe88..d69e88413d 100755 --- a/frappe/email/doctype/email_alert/email_alert.py +++ b/frappe/email/doctype/email_alert/email_alert.py @@ -112,55 +112,52 @@ def get_context(context): context = get_context(doc) recipients = [] - try: - for recipient in self.recipients: - if recipient.condition: - if not frappe.safe_eval(recipient.condition, None, context): - continue - if recipient.email_by_document_field: - if validate_email_add(doc.get(recipient.email_by_document_field)): - recipient.email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") - recipients = recipients + recipient.email_by_document_field.split("\n") - - # else: - # print "invalid email" - if recipient.cc: - recipient.cc = recipient.cc.replace(",", "\n") - recipients = recipients + recipient.cc.split("\n") - - #For sending emails to specified role - if recipient.email_by_role: - emails = get_emails_from_role(recipient.email_by_role) - - for email in emails: - recipients = recipients + email.split("\n") - - if not recipients: - return + for recipient in self.recipients: + if recipient.condition: + if not frappe.safe_eval(recipient.condition, None, context): + continue + if recipient.email_by_document_field: + if validate_email_add(doc.get(recipient.email_by_document_field)): + recipient.email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") + recipients = recipients + recipient.email_by_document_field.split("\n") + + # else: + # print "invalid email" + if recipient.cc: + recipient.cc = recipient.cc.replace(",", "\n") + recipients = recipients + recipient.cc.split("\n") + + #For sending emails to specified role + if recipient.email_by_role: + emails = get_emails_from_role(recipient.email_by_role) + + for email in emails: + recipients = recipients + email.split("\n") + + if not recipients: + return - recipients = list(set(recipients)) - subject = self.subject + recipients = list(set(recipients)) + subject = self.subject - context = {"doc": doc, "alert": self, "comments": None} + context = {"doc": doc, "alert": self, "comments": None} - if self.is_standard: - self.load_standard_properties(context) + if self.is_standard: + self.load_standard_properties(context) - if doc.get("_comments"): - context["comments"] = json.loads(doc.get("_comments")) + if doc.get("_comments"): + context["comments"] = json.loads(doc.get("_comments")) - if "{" in subject: - subject = frappe.render_template(self.subject, context) + if "{" in subject: + subject = frappe.render_template(self.subject, context) - attachments = get_attachment(doc) + attachments = get_attachment(doc) - frappe.sendmail(recipients=recipients, subject=subject, - message= frappe.render_template(self.message, context), - reference_doctype = doc.doctype, - reference_name = doc.name, - attachments = attachments) - except Exception: - frappe.throw("Error in Email Alert") + frappe.sendmail(recipients=recipients, subject=subject, + message= frappe.render_template(self.message, context), + reference_doctype = doc.doctype, + reference_name = doc.name, + attachments = attachments) def load_standard_properties(self, context): module = get_doc_module(self.module, self.doctype, self.name) @@ -239,6 +236,9 @@ def evaluate_alert(doc, alert, event): alert.send(doc) except TemplateError: frappe.throw(_("Error while evaluating Email Alert {0}. Please fix your template.").format(alert)) + except Exception, e: + frappe.log_error(message=frappe.get_traceback(), title=e) + frappe.throw("Error in Email Alert") def get_context(doc): return {"doc": doc, "nowdate": nowdate, "frappe.utils": frappe.utils} diff --git a/frappe/integrations/doctype/dropbox_settings/dropbox_settings.js b/frappe/integrations/doctype/dropbox_settings/dropbox_settings.js index 0fd4e195b1..a9cdeca66a 100644 --- a/frappe/integrations/doctype/dropbox_settings/dropbox_settings.js +++ b/frappe/integrations/doctype/dropbox_settings/dropbox_settings.js @@ -14,7 +14,9 @@ frappe.ui.form.on('Dropbox Settings', { freeze: true, callback: function(r) { if(!r.exc) { - frm.save(); + frm.set_value('dropbox_access_key', r.message.dropbox_access_key) + frm.set_value('dropbox_access_secret', r.message.dropbox_access_secret) + frm.save() window.open(r.message.url); } } diff --git a/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py b/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py index fea422c1c1..3461afbbf9 100644 --- a/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py +++ b/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py @@ -58,8 +58,6 @@ def get_dropbox_authorize_url(): "dropbox_access_secret": request_token.secret }) - doc.save(ignore_permissions=False) - return_address = get_request_site_address(True) \ + "?cmd=frappe.integrations.doctype.dropbox_settings.dropbox_settings.dropbox_callback" diff --git a/frappe/public/js/frappe/form/multi_select_dialog.js b/frappe/public/js/frappe/form/multi_select_dialog.js index 7a0635b6b8..f61e1021c8 100644 --- a/frappe/public/js/frappe/form/multi_select_dialog.js +++ b/frappe/public/js/frappe/form/multi_select_dialog.js @@ -18,7 +18,18 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ make: function() { let me = this; - let fields = []; + this.page_length = 20; + + let fields = [ + { + fieldtype: "Data", + label: __("Search term"), + fieldname: "search_term" + }, + { + fieldtype: "Column Break" + } + ]; let count = 0; if(!this.date_field) { this.date_field = "transaction_date"; @@ -31,12 +42,17 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ options: me.target.fields_dict[setter].df.options, default: me.setters[setter] }); - if (count++ < Object.keys(me.setters).length - 1) { + if (count++ < Object.keys(me.setters).length) { fields.push({fieldtype: "Column Break"}); } }); fields = fields.concat([ + { + "fieldname":"date_range", + "label": __("Date Range"), + "fieldtype": "DateRange", + }, { fieldtype: "Section Break" }, { fieldtype: "HTML", fieldname: "results_area" }, { fieldtype: "Button", fieldname: "make_new", label: __("Make a new " + me.doctype) } @@ -91,6 +107,19 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ this.$parent.find('.input-with-feedback').on('change', (e) => { this.get_results(); }); + + this.$parent.find('[data-fieldname="date_range"]').on('blur', (e) => { + this.get_results(); + }); + + this.$parent.find('[data-fieldname="search_term"]').on('input', (e) => { + var $this = $(this); + clearTimeout($this.data('timeout')); + $this.data('timeout', setTimeout(function() { + me.get_results(); + }, 300)); + }); + this.$parent.on('click', '.btn[data-fieldname="make_new"]', (e) => { frappe.route_options = {}; Object.keys(this.setters).forEach(function(setter) { @@ -118,17 +147,17 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ columns.forEach(function(column) { contents += `
${ - head ? __(frappe.model.unscrub(column)) + head ? `${__(frappe.model.unscrub(column))}` - : (column !== "name" ? __(result[column]) - : ` + : (column !== "name" ? `${__(result[column])}` + : ` ${__(result[column])}`) }
`; }) let $row = $(`
-
+
${contents} @@ -139,7 +168,7 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ return $row; }, - render_result_list: function(results) { + render_result_list: function(results, more = 0) { var me = this; this.$results.empty(); if(results.length === 0) { @@ -153,6 +182,11 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ results.forEach((result) => { me.$results.append(me.make_list_row(result)); }) + if (more) { + let message = __("Only {0} entries shown. Please filter for more specific results.", [this.page_length]); + me.$results.append($(`
${message}
`)); + } }, get_results: function() { @@ -164,12 +198,17 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ me.args[setter] = filters[setter]; }); + let date_val = this.dialog.fields_dict["date_range"].get_value(); + if(date_val) { + filters[this.date_field] = ['Between', me.dialog.fields_dict["date_range"].parse(date_val)]; + } + let args = { doctype: me.doctype, - txt: '', + txt: me.dialog.fields_dict["search_term"].get_value(), filters: filters, filter_fields: Object.keys(me.setters).concat([me.date_field]), - page_len: null, + page_length: this.page_length + 1, query: this.get_query().query, as_dict: 1 } @@ -179,8 +218,12 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ no_spinner: true, args: args, callback: function(r) { - let results = []; + let results = [], more = 0; if(r.values.length) { + if(r.values.length > me.page_length){ + r.values.pop(); + more = 1; + } r.values.forEach(function(result) { if(me.date_field in result) { result["Date"] = result[me.date_field] @@ -200,7 +243,7 @@ frappe.ui.form.MultiSelectDialog = Class.extend({ // Preselect oldest entry results[0].checked = 1 } - me.render_result_list(results); + me.render_result_list(results, more); } }); }, diff --git a/frappe/templates/pages/integrations/payment-success.html b/frappe/templates/pages/integrations/payment-success.html index 2d8397ff7c..ee1dc4930e 100644 --- a/frappe/templates/pages/integrations/payment-success.html +++ b/frappe/templates/pages/integrations/payment-success.html @@ -3,7 +3,7 @@ {% block title %}{{ _("Payment Success") }}{% endblock %} {%- block header -%} -

{{ _("Payment Success") }}

+

{{ _("Payment Success") }}

{% endblock %} {%- block page_content -%} diff --git a/frappe/translations/es.csv b/frappe/translations/es.csv index 81cd524e34..7613c8775b 100644 --- a/frappe/translations/es.csv +++ b/frappe/translations/es.csv @@ -2842,4 +2842,4 @@ DocType: Translation,"If your data is in HTML, please copy paste the exact HTML apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,No se puede abrir el archivo adjunto. Ha exportado como CSV? DocType: DocField,Ignore User Permissions,Ignorar los permisos de usuario apps/frappe/frappe/core/doctype/user/user.py +736,Please ask your administrator to verify your sign-up,"Por favor, consulte a su administrador para verificar su registro" -apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Mostrar registro +apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Mostrar registro \ No newline at end of file diff --git a/frappe/translations/fi.csv b/frappe/translations/fi.csv index 8479ae0862..d298c8191e 100644 --- a/frappe/translations/fi.csv +++ b/frappe/translations/fi.csv @@ -2831,4 +2831,4 @@ DocType: Translation,"If your data is in HTML, please copy paste the exact HTML apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,Ei voi avata liitetiedosto. Oletko viedä sen CSV? DocType: DocField,Ignore User Permissions,ohita käyttäjäoikeudet apps/frappe/frappe/core/doctype/user/user.py +736,Please ask your administrator to verify your sign-up,Pyydä ylläpitäjää tarkistaa rekisteröitymisen -apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Näytä loki +apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Näytä loki \ No newline at end of file diff --git a/frappe/translations/fr.csv b/frappe/translations/fr.csv index b18287495d..015922a4ba 100644 --- a/frappe/translations/fr.csv +++ b/frappe/translations/fr.csv @@ -1213,7 +1213,7 @@ apps/frappe/frappe/core/page/data_import_tool/data_import_tool.js +129,"Import R apps/frappe/frappe/core/page/permission_manager/permission_manager.js +162,No Permissions set for this criteria.,Aucune Autorisations définies pour ce critère. DocType: Auto Email Report,Auto Email Report,Rapport par Email Automatique apps/frappe/frappe/core/page/usage_info/usage_info.html +51,Max Emails,Nombre Max d'E-mails -apps/frappe/frappe/public/js/frappe/form/footer/timeline.js +574,Delete comment?,Supprimer le commentaire ? +apps/frappe/frappe/public/js/frappe/form/footer/timeline.js +574,Delete comment?,Supprimer le commentaire ? DocType: Address Template,This format is used if country specific format is not found,Ce format est utilisé si un format spécifique au pays n'est pas trouvé apps/frappe/frappe/public/js/frappe/request.js +104,You do not have enough permissions to access this resource. Please contact your manager to get access.,Vous ne disposez pas de suffisamment d'autorisations pour accéder à cette ressource. Veuillez contacter votre responsable pour obtenir l'accès. DocType: Custom Field,Custom,Personnaliser @@ -2130,7 +2130,7 @@ apps/frappe/frappe/printing/page/print_format_builder/print_format_builder.js +4 apps/frappe/frappe/www/update-password.html +14,Old Password,Ancien Mot De Passe apps/frappe/frappe/website/doctype/blog_post/blog_post.py +102,Posts by {0},Messages de {0} apps/frappe/frappe/core/doctype/report/report.js +9,"To format columns, give column labels in the query.","Pour formater des colonnes, donnez des étiquettes de colonne dans la requête." -apps/frappe/frappe/www/login.html +67,Don't have an account? Sign up,Vous n’avez pas encore de compte ? Inscrivez-vous +apps/frappe/frappe/www/login.html +67,Don't have an account? Sign up,Vous n’avez pas encore de compte ? Inscrivez-vous apps/frappe/frappe/core/doctype/doctype/doctype.py +691,{0}: Cannot set Assign Amend if not Submittable,{0} : Impossible de définir ‘Assigner Modifier’ si non Soumissible apps/frappe/frappe/core/page/user_permissions/user_permissions.js +14,Edit Role Permissions,Modifier les Autorisations de Rôle DocType: Communication,Link DocType,DocType du Lien @@ -2525,7 +2525,7 @@ apps/frappe/frappe/email/doctype/email_alert/email_alert.py +106,"Not allowed to apps/frappe/frappe/www/contact.py +54,New Message from Website Contact Page,Nouveau Message depuis la Page Contact du Site Web DocType: Email Alert,Reference Date,Date de Référence apps/frappe/frappe/public/js/frappe/desk.js +17,Some of the features might not work in your browser. Please update your browser to the latest version.,Certaines des fonctionnalités peuvent ne pas fonctionner dans votre navigateur. Veuillez mettre à jour votre navigateur vers la dernière version. -apps/frappe/frappe/utils/bot.py +185,"Don't know, ask 'help'","Vous ne savez pas, demandez de l’ ‘aide’" +apps/frappe/frappe/utils/bot.py +185,"Don't know, ask 'help'","Vous ne savez pas, demandez de l’ ‘aide’" DocType: DocType,Comments and Communications will be associated with this linked document,Commentaires et Communications seront associés à ce document lié apps/frappe/frappe/printing/page/print_format_builder/print_format_builder_sidebar.html +3,Filter...,Filtre ... DocType: Workflow State,bold,gras @@ -2846,4 +2846,4 @@ DocType: Translation,"If your data is in HTML, please copy paste the exact HTML apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,Impossible d'ouvrir le fichier joint. L'avez-vous exporté au format CSV ? DocType: DocField,Ignore User Permissions,Ignorer les Autorisations des Utilisateurs apps/frappe/frappe/core/doctype/user/user.py +736,Please ask your administrator to verify your sign-up,Veuillez demander à votre administrateur de vérifier votre inscription -apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Afficher le Journal +apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Afficher le Journal \ No newline at end of file diff --git a/frappe/translations/it.csv b/frappe/translations/it.csv index 3933c85574..5ab664b638 100644 --- a/frappe/translations/it.csv +++ b/frappe/translations/it.csv @@ -2845,4 +2845,4 @@ DocType: Translation,"If your data is in HTML, please copy paste the exact HTML apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,Impossibile aprire il file allegato. E' stato esportato in formato CSV? DocType: DocField,Ignore User Permissions,Ignora autorizzazioni utente apps/frappe/frappe/core/doctype/user/user.py +736,Please ask your administrator to verify your sign-up,Si prega di chiedere all'amministratore di verificare la tua iscrizione -apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Mostra registro +apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,Mostra registro \ No newline at end of file diff --git a/frappe/translations/kn.csv b/frappe/translations/kn.csv index cc1ce63559..de23688868 100644 --- a/frappe/translations/kn.csv +++ b/frappe/translations/kn.csv @@ -2909,4 +2909,4 @@ DocType: Translation,"If your data is in HTML, please copy paste the exact HTML apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,ಲಗತ್ತಿಸಲಾದ ಫೈಲ್ ತೆರೆಯಲು ಸಾಧ್ಯವಾಗುತ್ತಿಲ್ಲ. ನೀವು CSV ಮಾಹಿತಿ ಇದು ರಫ್ತು ಮಾಡಲಿಲ್ಲ? DocType: DocField,Ignore User Permissions,ಬಳಕೆದಾರ ಅನುಮತಿಗಳು ನಿರ್ಲಕ್ಷಿಸು apps/frappe/frappe/core/doctype/user/user.py +736,Please ask your administrator to verify your sign-up,ನಿಮ್ಮ ಸೈನ್ ಅಪ್ ಪರಿಶೀಲಿಸಲು ದಯವಿಟ್ಟು ನಿಮ್ಮ ನಿರ್ವಾಹಕರಿಗೆ ತಿಳಿಸಿ -apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,ಲಾಗ್ ಶೋ +apps/frappe/frappe/public/js/integrations/razorpay.js +21,Show Log,ಲಾಗ್ ಶೋ \ No newline at end of file diff --git a/frappe/translations/pt-BR.csv b/frappe/translations/pt-BR.csv index 372ec5d286..ab696c01ab 100644 --- a/frappe/translations/pt-BR.csv +++ b/frappe/translations/pt-BR.csv @@ -1601,4 +1601,4 @@ DocType: Web Form,Amount Field,Campo Valor DocType: Dropbox Settings,Send Notifications To,Enviar Notificações para DocType: Bulk Update,Max 500 records at a time,Máximo de 500 registros por vez apps/frappe/frappe/utils/csvutils.py +35,Unable to open attached file. Did you export it as CSV?,Foi impossível abrir o arquivo anexado. Você o exportou como CSV? -DocType: DocField,Ignore User Permissions,Ignorar permissões de usuário +DocType: DocField,Ignore User Permissions,Ignorar permissões de usuário \ No newline at end of file