Merge branch 'develop' into dont_create_contacts

This commit is contained in:
Suraj Shetty 2020-05-08 23:23:08 +05:30 committed by GitHub
commit 09fe8eaff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 35 additions and 20 deletions

View file

@ -23,7 +23,7 @@ if PY2:
reload(sys)
sys.setdefaultencoding("utf-8")
__version__ = '12.0.0-dev'
__version__ = '13.0.0-dev'
__title__ = "Frappe Framework"
local = Local()

View file

@ -26,6 +26,7 @@ class Comment(Document):
def validate(self):
if not self.comment_email:
self.comment_email = frappe.session.user
self.content = frappe.utils.sanitize_html(self.content)
def on_update(self):
update_comment_in_doc(self)

View file

@ -1,6 +1,5 @@
{
"actions": [],
"autoname": "CARD.#####",
"creation": "2020-04-15 18:06:39.444683",
"doctype": "DocType",
"editable_grid": 1,
@ -99,7 +98,7 @@
}
],
"links": [],
"modified": "2020-05-01 15:23:29.550243",
"modified": "2020-05-06 19:47:57.753574",
"modified_by": "Administrator",
"module": "Desk",
"name": "Number Card",

View file

@ -6,10 +6,15 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import cint
from frappe.model.naming import append_number_if_name_exists
class NumberCard(Document):
pass
def autoname(self):
if not self.name:
self.name = self.label
if frappe.db.exists("Number Card", self.name):
self.name = append_number_if_name_exists('Number Card', self.name)
def get_permission_query_conditions(user=None):
if not user:

View file

@ -10,7 +10,7 @@ from frappe.utils import split_emails, get_backups_path
def send_email(success, service_name, doctype, email_field, error_status=None):
recipients = get_recipients(service_name, email_field)
recipients = get_recipients(doctype, email_field)
if not recipients:
frappe.log_error("No Email Recipient found for {0}".format(service_name),
"{0}: Failed to send backup status email".format(service_name))
@ -36,11 +36,11 @@ def send_email(success, service_name, doctype, email_field, error_status=None):
frappe.sendmail(recipients=recipients, subject=subject, message=message)
def get_recipients(service_name, email_field):
def get_recipients(doctype, email_field):
if not frappe.db:
frappe.connect()
return split_emails(frappe.db.get_value(service_name, None, email_field))
return split_emails(frappe.db.get_value(doctype, None, email_field))
def get_latest_backup_file(with_files=False):

View file

@ -453,14 +453,14 @@ class Meta(Document):
link.added = False
for group in data.transactions:
# group found
if group.label == link.label:
if not link.link_doctype in group.items:
group.items.append(link.link_doctype)
if link.group and group.label == link.group:
if link.link_doctype not in group.get('items'):
group.get('items').append(link.link_doctype)
link.added = True
if not link.added:
# group not found, make a new group
data.transactions.append(dict(
data.transactions.append(frappe._dict(
label = link.group,
items = [link.link_doctype]
))

View file

@ -16,7 +16,7 @@ frappe.ui.form.ControlRating = frappe.ui.form.ControlInt.extend({
$(this.input_area).find('i').hover((ev) => {
const el = $(ev.currentTarget);
let star_value = el.data('rating');
el.parent().children('i.fa').each( function(e){
el.parent().children('i.fa').each( function(e) {
if (e < star_value) {
$(this).addClass('star-hover');
} else {

View file

@ -21,6 +21,12 @@ frappe.ui.form.Review = class Review {
});
}
make_review_container() {
this.parent.append(`
<ul class="list-unstyled sidebar-menu">
<li class="h6 reviews-label">${__('Reviews')}</li>
<li class="review-list"></li>
</ul>
`);
this.review_list_wrapper = this.parent.find('.review-list');
}
add_review_button() {

View file

@ -69,10 +69,7 @@
<div class="clearfix"></div>
</li>
</ul>
<ul class="list-unstyled sidebar-menu form-reviews">
<li class="h6 attachments-label">{%= __("Reviews") %}</li>
<li class="review-list"></li>
</ul>
<span class="form-reviews"></span>
<ul class="list-unstyled sidebar-menu">
<li class="h6 shared-with-label">{%= __("Shared With") %}</li>
<li class="form-shared"></li>

View file

@ -52,8 +52,10 @@ class EnergyPointLog(Document):
reference_log.reverted = 0
reference_log.save()
def revert(self, reason):
frappe.only_for('System Manager')
def revert(self, reason, ignore_permissions=False):
if not ignore_permissions:
frappe.only_for('System Manager')
if self.type != 'Auto':
frappe.throw(_('This document cannot be reverted'))

View file

@ -110,7 +110,7 @@ def revert_points_for_cancelled_doc(doc):
})
for log in energy_point_logs:
reference_log = frappe.get_doc('Energy Point Log', log.name)
reference_log.revert(_('Reference document has been cancelled'))
reference_log.revert(_('Reference document has been cancelled'), ignore_permissions=True)
def get_energy_point_doctypes():

View file

@ -3,7 +3,9 @@
frappe.ui.form.on('Energy Point Settings', {
refresh: function(frm) {
frm.add_custom_button(__('Give Review Points'), show_review_points_dialog);
if (frm.doc.enabled) {
frm.add_custom_button(__('Give Review Points'), show_review_points_dialog);
}
}
});

View file

@ -59,6 +59,9 @@ def sanitize_html(html, linkify=False):
elif is_json(html):
return html
if not bool(BeautifulSoup(html, 'html.parser').find()):
return html
tags = (acceptable_elements + svg_elements + mathml_elements
+ ["html", "head", "meta", "link", "body", "style", "o:p"])
attributes = {"*": acceptable_attributes, 'svg': svg_attributes}