Merge branch 'develop'
This commit is contained in:
commit
265dbd1473
11 changed files with 44 additions and 28 deletions
|
|
@ -1,2 +1,2 @@
|
|||
from __future__ import unicode_literals
|
||||
__version__ = "5.0.27"
|
||||
__version__ = "5.0.28"
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class Comment(Document):
|
|||
"""Updates `_comments` property in parent Document with given dict.
|
||||
|
||||
:param _comments: Dict of comments."""
|
||||
if frappe.db.get_value("DocType", self.comment_doctype, "issingle"):
|
||||
if not self.comment_doctype or frappe.db.get_value("DocType", self.comment_doctype, "issingle"):
|
||||
return
|
||||
|
||||
# use sql, so that we do not mess with the timestamp
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ class Communication(Document):
|
|||
frappe.db.set_value(parent.doctype, parent.name, "status", to_status)
|
||||
|
||||
def send(self, print_html=None, print_format=None, attachments=None,
|
||||
send_me_a_copy=False):
|
||||
send_me_a_copy=False, recipients=None):
|
||||
"""Send communication via Email.
|
||||
|
||||
:param print_html: Send given value as HTML attachment.
|
||||
:param print_format: Attach print format of parent document."""
|
||||
|
||||
self.send_me_a_copy = send_me_a_copy
|
||||
self.notify(print_html, print_format, attachments)
|
||||
self.notify(print_html, print_format, attachments, recipients)
|
||||
|
||||
def set_incoming_outgoing_accounts(self):
|
||||
self.incoming_email_account = self.outgoing_email_account = None
|
||||
|
|
@ -71,9 +71,10 @@ class Communication(Document):
|
|||
self.outgoing_email_account = frappe.db.get_value("Email Account", {"default_outgoing": 1},
|
||||
["email_id", "always_use_account_email_id_as_sender"], as_dict=True) or frappe._dict()
|
||||
|
||||
def notify(self, print_html=None, print_format=None, attachments=None, except_recipient=False):
|
||||
def notify(self, print_html=None, print_format=None, attachments=None, recipients=None, except_recipient=False):
|
||||
self.prepare_to_notify(print_html, print_format, attachments)
|
||||
recipients = self.get_recipients(except_recipient=except_recipient)
|
||||
if not recipients:
|
||||
recipients = self.get_recipients(except_recipient=except_recipient)
|
||||
|
||||
frappe.sendmail(
|
||||
recipients=recipients,
|
||||
|
|
@ -246,11 +247,17 @@ def make(doctype=None, name=None, content=None, subject=None, sent_or_received =
|
|||
"reference_name": name
|
||||
})
|
||||
comm.insert(ignore_permissions=True)
|
||||
|
||||
|
||||
recipients = None
|
||||
if send_email:
|
||||
comm.send(print_html, print_format, attachments, send_me_a_copy=send_me_a_copy)
|
||||
comm.send_me_a_copy = send_me_a_copy
|
||||
recipients = comm.get_recipients()
|
||||
comm.send(print_html, print_format, attachments, send_me_a_copy=send_me_a_copy, recipients=recipients)
|
||||
|
||||
return comm.name
|
||||
return {
|
||||
"name": comm.name,
|
||||
"recipients": ", ".join(recipients) if recipients else None
|
||||
}
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_convert_to():
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class TestEmailAccount(unittest.TestCase):
|
|||
# send
|
||||
sent_name = make(subject = "Test", content="test content",
|
||||
recipients="test_receiver@example.com", sender="test@example.com",
|
||||
send_email=True)
|
||||
send_email=True)["name"]
|
||||
|
||||
sent_mail = email.message_from_string(frappe.get_last_doc("Bulk Email").message)
|
||||
with open(os.path.join(os.path.dirname(__file__), "test_mails", "reply-1.raw"), "r") as f:
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ app_title = "Frappe Framework"
|
|||
app_publisher = "Frappe Technologies Pvt. Ltd."
|
||||
app_description = "Full Stack Web Application Framework in Python"
|
||||
app_icon = "octicon octicon-circuit-board"
|
||||
app_version = "5.0.27"
|
||||
app_version = "5.0.28"
|
||||
app_color = "orange"
|
||||
|
||||
app_email = "support@frappe.io"
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ class BaseDocument(object):
|
|||
|
||||
def cast(self, val, df):
|
||||
if df.fieldtype in ("Currency", "Float", "Percent"):
|
||||
val = flt(val, self.precision(df.fieldname))
|
||||
val = flt(val)
|
||||
|
||||
elif df.fieldtype in ("Int", "Check"):
|
||||
val = cint(val)
|
||||
|
|
|
|||
|
|
@ -37,19 +37,8 @@ frappe.ui.form.Layout = Class.extend({
|
|||
this.wrapper.find(".empty-form-alert").remove();
|
||||
}
|
||||
|
||||
for(var i=0, l=this.fields_list.length; i<l; i++) {
|
||||
var fieldobj = this.fields_list[i];
|
||||
if(me.doc) {
|
||||
fieldobj.doc = me.doc;
|
||||
fieldobj.doctype = me.doc.doctype;
|
||||
fieldobj.docname = me.doc.name;
|
||||
fieldobj.df = frappe.meta.get_docfield(me.doc.doctype,
|
||||
fieldobj.df.fieldname, me.frm.doc.name);
|
||||
// on form change, permissions can change
|
||||
fieldobj.perm = me.frm.perm;
|
||||
};
|
||||
fieldobj.refresh && fieldobj.refresh();
|
||||
}
|
||||
// NOTE this might seem redundant at first, but it needs to be executed when frm.refresh_fields is called
|
||||
me.attach_doc_and_docfields(true);
|
||||
|
||||
if(this.frm && this.frm.wrapper) {
|
||||
$(this.frm.wrapper).trigger("refresh-fields");
|
||||
|
|
@ -72,6 +61,23 @@ frappe.ui.form.Layout = Class.extend({
|
|||
// refresh sections
|
||||
this.refresh_sections();
|
||||
},
|
||||
attach_doc_and_docfields: function(refresh) {
|
||||
var me = this;
|
||||
for(var i=0, l=this.fields_list.length; i<l; i++) {
|
||||
var fieldobj = this.fields_list[i];
|
||||
if(me.doc) {
|
||||
fieldobj.doc = me.doc;
|
||||
fieldobj.doctype = me.doc.doctype;
|
||||
fieldobj.docname = me.doc.name;
|
||||
fieldobj.df = frappe.meta.get_docfield(me.doc.doctype,
|
||||
fieldobj.df.fieldname, me.frm.doc.name);
|
||||
|
||||
// on form change, permissions can change
|
||||
fieldobj.perm = me.frm.perm;
|
||||
};
|
||||
refresh && fieldobj.refresh && fieldobj.refresh();
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
var me = this;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ frappe.ui.TagEditor = Class.extend({
|
|||
method:"frappe.desk.tags.get_tags",
|
||||
args:{
|
||||
doctype: me.frm.doctype,
|
||||
txt: request.term
|
||||
txt: request.term.toLowerCase()
|
||||
},
|
||||
callback: function(r) {
|
||||
response(r.message);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ frappe.views.CommunicationComposer = Class.extend({
|
|||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
if(form_values.send_email)
|
||||
msgprint(__("Email sent to {0}", [form_values.recipients]));
|
||||
msgprint(__("Email sent to {0}", [r.message["recipients"]]));
|
||||
me.dialog.hide();
|
||||
|
||||
if (cur_frm) {
|
||||
|
|
|
|||
|
|
@ -400,6 +400,9 @@ _f.Frm.prototype.refresh = function(docname) {
|
|||
|
||||
_f.Frm.prototype.render_form = function() {
|
||||
if(!this.meta.istable) {
|
||||
this.layout.doc = this.doc;
|
||||
this.layout.attach_doc_and_docfields()
|
||||
|
||||
this.sidebar = new frappe.ui.form.Sidebar({
|
||||
frm: this,
|
||||
page: this.page
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -1,6 +1,6 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
version = "5.0.27"
|
||||
version = "5.0.28"
|
||||
|
||||
with open("requirements.txt", "r") as f:
|
||||
install_requires = f.readlines()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue