diff --git a/frappe/core/doctype/docperm/docperm.py b/frappe/core/doctype/docperm/docperm.py index 72a48001c3..70d9cb1fdb 100644 --- a/frappe/core/doctype/docperm/docperm.py +++ b/frappe/core/doctype/docperm/docperm.py @@ -7,5 +7,5 @@ import frappe from frappe.model.document import Document class DocPerm(Document): - __doclink__ = "https://frappe.io/docs/models/core/docperm" + __doclink__ = "https://frappe.io/docs/models/v5.x/core/docperm" pass diff --git a/frappe/database.py b/frappe/database.py index 86a2c57574..50e06c7d88 100644 --- a/frappe/database.py +++ b/frappe/database.py @@ -90,7 +90,7 @@ class Database: frappe.db.sql("select name from tabCustomer where name like %s", "a%") # values as dict - frappe.db.sql("select name from tabCustomer where name like %(name)s and owner="%(owner)s", + frappe.db.sql("select name from tabCustomer where name like %(name)s and owner=%(owner)s", {"name": "a%", "owner":"test@example.com"}) """ diff --git a/frappe/email/bulk.py b/frappe/email/bulk.py index f76a87c9a1..ef5fce4358 100644 --- a/frappe/email/bulk.py +++ b/frappe/email/bulk.py @@ -56,7 +56,8 @@ def send(recipients=None, sender=None, doctype='User', email_field='email', if not recipients: recipients = [] if not sender or sender == "Administrator": - sender = get_outgoing_email_account().email_id + email_account = get_outgoing_email_account() + sender = email_account.get("sender") or email_account.email_id check_bulk_limit(len(recipients)) formatted = get_formatted_html(subject, message) diff --git a/frappe/email/doctype/email_account/email_account.json b/frappe/email/doctype/email_account/email_account.json index 65c81023e9..7e421f007c 100644 --- a/frappe/email/doctype/email_account/email_account.json +++ b/frappe/email/doctype/email_account/email_account.json @@ -32,6 +32,73 @@ "permlevel": 0, "precision": "" }, + { + "fieldname": "service", + "fieldtype": "Select", + "label": "Service", + "options": "\nGMail\nYahoo Mail\nOutlook.com", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Email Id", + "no_copy": 0, + "options": "email", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "password", + "fieldtype": "Password", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Password", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "description": "e.g. \"Support\", \"Sales\", \"Jerry Yang\"", + "fieldname": "email_account_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Email Account Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, { "description": "Append as communication against this DocType (must have fields, \"Status\", \"Subject\")", "fieldname": "append_to", @@ -81,73 +148,6 @@ "search_index": 0, "set_only_once": 0 }, - { - "fieldname": "service", - "fieldtype": "Select", - "label": "Service", - "options": "\nGMail\nYahoo Mail\nOutlook.com", - "permlevel": 0, - "precision": "" - }, - { - "allow_on_submit": 0, - "fieldname": "email_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Email Id", - "no_copy": 0, - "options": "email", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0 - }, - { - "allow_on_submit": 0, - "description": "e.g. \"Support\", \"Sales\", \"Jerry Yang\"", - "fieldname": "email_account_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Email Account Name", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0 - }, - { - "allow_on_submit": 0, - "fieldname": "password", - "fieldtype": "Password", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Password", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0 - }, { "allow_on_submit": 0, "description": "e.g. pop.gmail.com", @@ -362,7 +362,7 @@ "is_submittable": 0, "issingle": 0, "istable": 0, - "modified": "2014-09-15 12:01:38.649639", + "modified": "2014-12-15 15:20:22.723848", "modified_by": "Administrator", "module": "Email", "name": "Email Account", diff --git a/frappe/email/smtp.py b/frappe/email/smtp.py index 5547c682dd..0303471765 100644 --- a/frappe/email/smtp.py +++ b/frappe/email/smtp.py @@ -53,7 +53,8 @@ def get_outgoing_email_account(raise_exception_not_set=True): "smtp_port": frappe.conf.get("mail_port"), "use_tls": cint(frappe.conf.get("use_ssl") or 0), "email_id": frappe.conf.get("mail_login"), - "password": frappe.conf.get("mail_password") + "password": frappe.conf.get("mail_password"), + "sender": frappe.conf.get("auto_email_id") }) email_account.from_site_config = True diff --git a/frappe/public/css/appframe.css b/frappe/public/css/appframe.css index 50a4fe8718..f3ea9b403c 100644 --- a/frappe/public/css/appframe.css +++ b/frappe/public/css/appframe.css @@ -1,8 +1,8 @@ /* appframe header */ .appframe { - padding-top: 15px; - padding-bottom: 15px; +/* padding-top: 15px; + padding-bottom: 15px;*/ } .appframe-wrapper { @@ -14,10 +14,9 @@ border-bottom: 1px solid #c7c7c7; } -.appframe-titlebar, .appframe-iconbar, .appframe-form, .appframe-primary-actions { - /*background-color: rgba(255, 255, 255, 0.7);*/ +/*.appframe-titlebar, .appframe-iconbar, .appframe-form, .appframe-primary-actions { background-color: #f9f9f9; -} +}*/ .appframe-primary-actions { border-bottom: 1px solid #c7c7c7; diff --git a/frappe/public/css/desk.css b/frappe/public/css/desk.css index 28fd101a2d..16c1bca8ce 100644 --- a/frappe/public/css/desk.css +++ b/frappe/public/css/desk.css @@ -31,6 +31,10 @@ a.form-link { font-size: 102%; } +em.link-option { + font-weight: normal; +} + .layout-main { padding-bottom: 10px; } @@ -69,8 +73,7 @@ div#freeze { .app-page { border: 1px solid #c7c7c7; - border-radius: 4px; - margin-top: 15px; + border-top: 0px; padding: 0px; overflow: hidden; } @@ -81,14 +84,17 @@ div#freeze { /* listing */ .show_filters { - padding-top: 15px; - padding-bottom: 15px; + padding: 15px; + padding-bottom: 5px; margin-bottom: 15px; border-bottom: 1px solid #c7c7c7; } -.set-filters .btn-group { +.set-filters .btn { margin-bottom: 10px; +} + +.set-filters .btn-group { margin-right: 10px; } diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index 7149fbacb8..2ddc310ddd 100644 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -810,13 +810,8 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ \ \ - \ - \ - \ - \ - \ - \ - \ + \ + \ \ ').prependTo(this.input_area); this.$input_area = $(this.input_area); @@ -841,17 +836,6 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ setup_buttons: function() { var me = this; - // magnifier - search - this.$input_area.find(".btn-search").on("click", function() { - var doctype = me.get_options(); - if(!doctype) return; - new frappe.ui.form.LinkSelector({ - doctype: doctype, - target: me, - txt: me.get_value() - }); - }); - // open this.$input_area.find(".btn-open").on("click", function() { var value = me.get_value(); @@ -859,18 +843,25 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ frappe.set_route("Form", me.get_options(), value); }); - // new - if(this.df.fieldtype==="Dynamic Link" || frappe.model.can_create(me.df.options)) { - this.$input_area.find(".btn-new").on("click", function() { - var doctype = me.get_options(); - if(!doctype) return; - me.frm.new_doc(doctype, me); - }); + if(this.only_input) this.$input_area.find(".btn-open").remove(); + }, + open_advanced_search: function() { + var doctype = this.get_options(); + if(!doctype) return; + new frappe.ui.form.LinkSelector({ + doctype: doctype, + target: this, + txt: this.get_value() + }); + }, + new_doc: function() { + var doctype = this.get_options(); + if(!doctype) return; + if(this.frm) { + this.frm.new_doc(doctype, this); } else { - this.$input_area.find(".btn-new").remove(); + new_doc(doctype); } - - if(this.only_input) this.$input_area.find(".btn-open, .btn-new").remove(); }, setup_autocomplete: function() { var me = this; @@ -915,12 +906,22 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ no_spinner: true, args: args, callback: function(r) { - if(frappe.model.can_create(doctype)) { + if(frappe.model.can_create(doctype) + && me.df.fieldtype !== "Dynamic Link") { + // new item r.results.push({ - value: " " + __("Create a new {0}", [__(me.df.options)]) + "", - make_new: true + value: " " + + __("Create a new {0}", [__(me.df.options)]) + "", + action: me.new_doc }); }; + // advanced search + r.results.push({ + value: " " + + __("Advanced Search") + "", + action: me.open_advanced_search + }); + me.$input.cache[doctype][request.term] = r.results; response(r.results); }, @@ -933,21 +934,14 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ me.autocomplete_open = false; }, focus: function( event, ui ) { - if(ui.item.make_new) { + if(ui.item.action) { return false; } }, select: function(event, ui) { me.autocomplete_open = false; - if(ui.item.make_new) { - var doctype = me.get_options(); - if(!doctype) return; - - if (me.frm) { - me.frm.new_doc(doctype, me); - } else { - new_doc(doctype); - } + if(ui.item.action) { + ui.item.action.apply(me); return false; } diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index dd4458258f..e5ec156953 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -170,7 +170,7 @@ frappe.ui.form.Layout = Class.extend({ var section = this.section[0]; section.df = df; if(df) { - if(df.label) { + if(df.label && false) { this.labelled_section_count++; var head = $('

' + (df.options ? (' ') : "") @@ -184,7 +184,7 @@ frappe.ui.form.Layout = Class.extend({ head.css({"margin-top": "0px"}) } - if(df.label || df.show_section_border) { + if(true || df.label || df.show_section_border) { if(this.sections.length > 1) { this.section.css("border-top", "1px solid #eee"); diff --git a/frappe/public/js/frappe/form/toolbar.js b/frappe/public/js/frappe/form/toolbar.js index 123fa980d0..c654c32071 100644 --- a/frappe/public/js/frappe/form/toolbar.js +++ b/frappe/public/js/frappe/form/toolbar.js @@ -21,7 +21,7 @@ frappe.ui.form.Toolbar = Class.extend({ this.appframe.iconbar.hide(); } else { this.appframe.iconbar.clear(1); - this.appframe.iconbar.clear(4) + this.appframe.iconbar.clear(4); this.make_file_menu(); this.make_cancel_amend_button(); this.set_title_right(); diff --git a/frappe/public/js/frappe/ui/appframe.js b/frappe/public/js/frappe/ui/appframe.js index 254a9f4a9f..80d130bbc3 100644 --- a/frappe/public/js/frappe/ui/appframe.js +++ b/frappe/public/js/frappe/ui/appframe.js @@ -246,11 +246,16 @@ frappe.ui.AppFrame = Class.extend({ }, add_icon_btn: function(group, icon, label, click) { - return this.iconbar.add_btn(group, icon, label, click); + if(this.sidebar_links.length) { + return $('' + label + '').appendTo($('

') + .appendTo(this.sidebar_links)).click(click); + } else { + return this.iconbar.add_btn(group, icon, label, click); + } }, add_button: function(label, click, icon, is_title) { - return this.iconbar.add_btn("1", icon, __(label), click); + return this.add_icon_btn("1", icon, __(label), click); }, add_dropdown_button: function(parent, label, click, icon) { @@ -337,7 +342,7 @@ frappe.ui.make_app_page = function(opts) { ] */ var $wrapper = $(opts.parent) - $('

\ + $('
\
\
\
\ @@ -348,25 +353,27 @@ frappe.ui.make_app_page = function(opts) {
\
\
\ -
\ -
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\
\
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ ').appendTo($wrapper); if(opts.single_column) { @@ -374,12 +381,16 @@ frappe.ui.make_app_page = function(opts) { } else { opts.parent.layout = $('
\
\ -
\ +
\ + \ +
\
').appendTo($wrapper.find(".appframe")); + opts.parent.body = opts.parent.layout.find(".layout-main-section"); } opts.parent.appframe = new frappe.ui.AppFrame($wrapper); + opts.parent.appframe.sidebar_links = $wrapper.find(".sidebar-links"); if(opts.set_document_title!==undefined) opts.parent.appframe.set_document_title = opts.set_document_title; if(opts.title) opts.parent.appframe.set_title(opts.title); diff --git a/frappe/public/js/frappe/ui/listing.js b/frappe/public/js/frappe/ui/listing.js index 616c65dc25..b0c1a95f08 100644 --- a/frappe/public/js/frappe/ui/listing.js +++ b/frappe/public/js/frappe/ui/listing.js @@ -71,10 +71,9 @@ frappe.ui.Listing = Class.extend({
\
\ \ - \
\
\ @@ -184,11 +183,11 @@ frappe.ui.Listing = Class.extend({ } // hide-filter - if(me.show_filters) { - this.add_button(__('Filter'), function() { - me.filter_list.add_filter(); - }, 'icon-filter').addClass('btn-filter'); - } + // if(me.show_filters) { + // this.add_button(__('Filter'), function() { + // me.filter_list.add_filter(); + // }, 'icon-filter').addClass('btn-filter'); + // } if(me.no_toolbar || me.hide_toolbar) { me.$w.find('.list-toolbar-wrapper').toggle(false); diff --git a/frappe/public/js/frappe/views/doclistview.js b/frappe/public/js/frappe/views/doclistview.js index 9c155ad7a7..4b25295e22 100644 --- a/frappe/public/js/frappe/views/doclistview.js +++ b/frappe/public/js/frappe/views/doclistview.js @@ -58,8 +58,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ .appendTo(this.$page.find(".layout-main-section")); this.$page.find(".layout-main-section") - .addClass("listview-main-section") - .parent().css({"margin-top":"-15px"}); + .addClass("listview-main-section"); this.appframe = this.page.appframe; var module = locals.DocType[this.doctype].module; @@ -69,7 +68,10 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ frappe.set_route(frappe.listview_parent_route[me.doctype] || frappe.get_module(module).link); }); - this.appframe.set_views_for(this.doctype, "list"); + this.appframe.add_button("Report View", function() { + frappe.set_route("Report", me.doctype); + }) + //this.appframe.set_views_for(this.doctype, "list"); }, setup: function() { @@ -87,7 +89,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ this.make_help(); this.setup_filterable(); this.init_filters(); - this.$page.find(".show_filters").css({"padding":"15px", "margin":"0px -15px"}); + this.$page.find(".show_filters").css({"margin":"0px -15px"}); }, init_listview: function() { @@ -294,7 +296,6 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ }, init_minbar: function() { var me = this; - this.appframe.add_icon_btn("2", 'icon-tag', __('Show Tags'), function() { me.toggle_tags(); }); this.$page.on("click", ".list-tag-preview", function() { me.toggle_tags(); }); @@ -402,7 +403,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ this.sidebar_stats = new frappe.views.SidebarStats({ doctype: this.doctype, stats: this.listview.stats, - parent: this.$page.find('.layout-side-section'), + parent: $('
').appendTo(this.$page.find('.layout-side-section')), set_filter: function(fieldname, label) { me.set_filter(fieldname, label); }, diff --git a/frappe/public/js/legacy/form.js b/frappe/public/js/legacy/form.js index 7fe330b5b8..d86425188f 100644 --- a/frappe/public/js/legacy/form.js +++ b/frappe/public/js/legacy/form.js @@ -82,12 +82,11 @@ _f.Frm.prototype.setup = function() { // wrapper this.wrapper = this.parent; frappe.ui.make_app_page({ - parent: this.wrapper, - single_column: true + parent: this.wrapper }); this.appframe = this.wrapper.appframe; this.layout_main = $(this.wrapper) - .find(".layout-main") + .find(".layout-main-section") .css({"padding-bottom": "0px"}) .get(0); @@ -326,7 +325,7 @@ _f.Frm.prototype.refresh_header = function() { _f.Frm.prototype.show_web_link = function() { var doc = this.doc; if(this.fields_dict.parent_website_route) { - if(!doc.__islocal && doc.__onload.published) { + if(!doc.__islocal && doc.__onload && doc.__onload.published) { cur_frm.set_intro(__("Published on website at: {0}", [repl('/%(website_route)s', doc.__onload)])); } else {