Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
仰若水
frappe
Commits
6afede2a
Commit
6afede2a
authored
7 years ago
by
Nabin Hait
Browse files
Options
Download
Plain Diff
Merge branch 'hotfix'
parents
645526bb
adef7e2e
develop
v11.1.5
v11.1.4
v11.1.3
v11.1.2
v11.1.1
v11.1.0
v11.0.3
v11.0.3-beta.51
v11.0.3-beta.50
v11.0.3-beta.49
v11.0.3-beta.48
v11.0.3-beta.47
v11.0.3-beta.46
v11.0.3-beta.45
v11.0.3-beta.44
v11.0.3-beta.43
v11.0.3-beta.42
v11.0.3-beta.41
v11.0.3-beta.40
v11.0.3-beta.39
v11.0.3-beta.38
v11.0.3-beta.37
v11.0.3-beta.36
v11.0.3-beta.35
v11.0.3-beta.34
v11.0.3-beta.33
v11.0.3-beta.32
v11.0.3-beta.31
v11.0.3-beta.30
v11.0.3-beta.29
v11.0.3-beta.28
v11.0.3-beta.27
v11.0.3-beta.26
v11.0.3-beta.25
v11.0.3-beta.24
v11.0.3-beta.23
v11.0.3-beta.22
v11.0.3-beta.21
v11.0.3-beta.20
v11.0.3-beta.19
v11.0.3-beta.18
v11.0.3-beta.17
v11.0.3-beta.16
v11.0.3-beta.15
v11.0.3-beta.14
v11.0.3-beta.13
v11.0.3-beta.12
v11.0.3-beta.11
v11.0.3-beta.10
v11.0.3-beta.9
v11.0.3-beta.8
v11.0.3-beta.7
v11.0.3-beta.6
v11.0.3-beta.5
v11.0.3-beta.4
v11.0.3-beta.3
v11.0.3-beta.2
v11.0.3-beta.1
v11.0.2
v11.0.1
v11.0.0-beta
v10.1.71
v10.1.70
v10.1.69
v10.1.68
v10.1.67
v10.1.66
v10.1.65
v10.1.64
v10.1.63
v10.1.62
v10.1.61
v10.1.60
v10.1.59
v10.1.58
v10.1.57
v10.1.56
v10.1.55
v10.1.54
v10.1.53
v10.1.52
v10.1.51
v10.1.50
v10.1.49
v10.1.49-beta.1
v10.1.48
v10.1.47
v10.1.46
v10.1.45
v10.1.44
v10.1.43
v10.1.42
v10.1.41
v10.1.40
v10.1.39
v10.1.38
v10.1.37
v10.1.36
v10.1.35
v10.1.34
v10.1.33
v10.1.32
v10.1.31
v10.1.30
v10.1.29
v10.1.28
v10.1.27
v10.1.26
v10.1.25
v10.1.24
v10.1.23
v10.1.22
v10.1.21
v10.1.20
v10.1.19
v10.1.18
v10.1.17
v10.1.16
v10.1.15
v10.1.14
v10.1.13
v10.1.12
v10.1.11
v10.1.10
v10.1.9
v10.1.8
v10.1.7
v10.1.6
v10.1.5
v10.1.4
v10.1.3
v10.1.2
v10.1.1
v10.1.0
v10.0.25
v10.0.24
v10.0.23
v10.0.22
v10.0.21
v10.0.20
v10.0.19
v10.0.18
v10.0.17
v10.0.16
v10.0.15
v10.0.14
v10.0.13
v10.0.12
v10.0.11
v10.0.10
v10.0.9
v10.0.8
v10.0.7
v10.0.6
v10.0.5
v10.0.4
v10.0.3
v10.0.2
v10.0.1
v10.0.0
v9.2.25
v9.2.24
v9.2.23
v9.2.22
v9.2.21
v9.2.20
v9.2.19
v9.2.18
v9.2.17
v9.2.16
v9.2.15
v9.2.14
v9.2.13
v9.2.12
v9.2.11
v9.2.10
v9.2.9
v9.2.8
v9.2.7
v9.2.6
v9.2.5
v9.2.4
v9.2.3
v9.2.2
v9.2.1
v9.2.0
v9.1.11
v9.1.10
v9.1.9
v9.1.8
v9.1.7
v9.1.6
v9.1.5
v9.1.4
v9.1.3
v9.1.2
v9.1.1
v9.1.0
v9.0.10
v9.0.9
v9.0.8
v9.0.7
v9.0.6
v9.0.5
v9.0.4
v9.0.3
v9.0.2
v9.0.1
No related merge requests found
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
frappe/__init__.py
+1
-1
frappe/__init__.py
frappe/core/doctype/communication/email.py
+6
-0
frappe/core/doctype/communication/email.py
frappe/email/email_body.py
+4
-4
frappe/email/email_body.py
frappe/email/queue.py
+2
-2
frappe/email/queue.py
frappe/email/smtp.py
+17
-7
frappe/email/smtp.py
frappe/public/js/frappe/form/controls/date_range.js
+1
-1
frappe/public/js/frappe/form/controls/date_range.js
frappe/public/js/frappe/form/formatters.js
+1
-1
frappe/public/js/frappe/form/formatters.js
frappe/public/js/frappe/ui/filters/filters.js
+2
-4
frappe/public/js/frappe/ui/filters/filters.js
frappe/public/js/frappe/ui/messages.js
+1
-1
frappe/public/js/frappe/ui/messages.js
with
35 additions
and
21 deletions
+35
-21
frappe/__init__.py
View file @
6afede2a
...
...
@@ -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.0.
0
'
__version__
=
'9.0.
1
'
__title__
=
"Frappe Framework"
local
=
Local
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/email.py
View file @
6afede2a
...
...
@@ -287,6 +287,12 @@ def set_incoming_outgoing_accounts(doc):
if
not
doc
.
outgoing_email_account
:
doc
.
outgoing_email_account
=
frappe
.
db
.
get_value
(
"Email Account"
,
{
"default_outgoing"
:
1
,
"enable_outgoing"
:
1
},
[
"email_id"
,
"always_use_account_email_id_as_sender"
,
"name"
,
"send_unsubscribe_message"
],
as_dict
=
True
)
or
frappe
.
_dict
()
if
not
doc
.
outgoing_email_account
:
# if from address is not the default email account
doc
.
outgoing_email_account
=
frappe
.
db
.
get_value
(
"Email Account"
,
{
"email_id"
:
doc
.
sender
,
"enable_outgoing"
:
1
},
[
"email_id"
,
"always_use_account_email_id_as_sender"
,
"name"
,
"send_unsubscribe_message"
],
as_dict
=
True
)
or
frappe
.
_dict
()
if
doc
.
sent_or_received
==
"Sent"
:
...
...
This diff is collapsed.
Click to expand it.
frappe/email/email_body.py
View file @
6afede2a
...
...
@@ -73,14 +73,14 @@ class EMail:
self
.
cc
=
cc
or
[]
self
.
html_set
=
False
self
.
email_account
=
email_account
or
get_outgoing_email_account
()
self
.
email_account
=
email_account
or
get_outgoing_email_account
(
sender
=
sender
)
def
set_html
(
self
,
message
,
text_content
=
None
,
footer
=
None
,
print_html
=
None
,
formatted
=
None
,
inline_images
=
None
,
header
=
None
):
"""Attach message in the html portion of multipart/alternative"""
if
not
formatted
:
formatted
=
get_formatted_html
(
self
.
subject
,
message
,
footer
,
print_html
,
email_account
=
self
.
email_account
,
header
=
header
)
email_account
=
self
.
email_account
,
header
=
header
,
sender
=
self
.
sender
)
# this is the first html part of a multi-part message,
# convert to text well
...
...
@@ -231,9 +231,9 @@ class EMail:
return
self
.
msg_root
.
as_string
()
def
get_formatted_html
(
subject
,
message
,
footer
=
None
,
print_html
=
None
,
email_account
=
None
,
header
=
None
,
unsubscribe_link
=
None
):
email_account
=
None
,
header
=
None
,
unsubscribe_link
=
None
,
sender
=
None
):
if
not
email_account
:
email_account
=
get_outgoing_email_account
(
False
)
email_account
=
get_outgoing_email_account
(
False
,
sender
=
sender
)
rendered_email
=
frappe
.
get_template
(
"templates/emails/standard.html"
).
render
({
"header"
:
get_header
(
header
),
...
...
This diff is collapsed.
Click to expand it.
frappe/email/queue.py
View file @
6afede2a
...
...
@@ -64,7 +64,7 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content=
if
isinstance
(
send_after
,
int
):
send_after
=
add_days
(
nowdate
(),
send_after
)
email_account
=
get_outgoing_email_account
(
True
,
append_to
=
reference_doctype
)
email_account
=
get_outgoing_email_account
(
True
,
append_to
=
reference_doctype
,
sender
=
sender
)
if
not
sender
or
sender
==
"Administrator"
:
sender
=
email_account
.
default_sender
...
...
@@ -401,7 +401,7 @@ def send_one(email, smtpserver=None, auto_commit=True, now=False, from_test=Fals
try
:
if
not
frappe
.
flags
.
in_test
:
if
not
smtpserver
:
smtpserver
=
SMTPServer
()
smtpserver
.
setup_email_account
(
email
.
reference_doctype
)
smtpserver
.
setup_email_account
(
email
.
reference_doctype
,
sender
=
email
.
sender
)
for
recipient
in
recipients_list
:
if
recipient
.
status
!=
"Not Sent"
:
...
...
This diff is collapsed.
Click to expand it.
frappe/email/smtp.py
View file @
6afede2a
...
...
@@ -7,8 +7,8 @@ import frappe
import
smtplib
import
email.utils
import
_socket
,
sys
from
frappe.utils
import
cint
from
frappe
import
_
from
frappe.utils
import
cint
,
parse_addr
def
send
(
email
,
append_to
=
None
,
retry
=
1
):
"""Deprecated: Send the message or add it to Outbox Email"""
...
...
@@ -35,22 +35,32 @@ def send(email, append_to=None, retry=1):
_send
(
retry
)
def
get_outgoing_email_account
(
raise_exception_not_set
=
True
,
append_to
=
None
):
def
get_outgoing_email_account
(
raise_exception_not_set
=
True
,
append_to
=
None
,
sender
=
None
):
"""Returns outgoing email account based on `append_to` or the default
outgoing account. If default outgoing account is not found, it will
try getting settings from `site_config.json`."""
sender_email_id
=
None
if
sender
:
sender_email_id
=
parse_addr
(
sender
)[
1
]
if
not
getattr
(
frappe
.
local
,
"outgoing_email_account"
,
None
):
frappe
.
local
.
outgoing_email_account
=
{}
if
not
frappe
.
local
.
outgoing_email_account
.
get
(
append_to
or
"default"
):
if
not
frappe
.
local
.
outgoing_email_account
.
get
(
append_to
or
sender_email_id
or
"default"
):
email_account
=
None
if
append_to
:
# append_to is only valid when enable_incoming is checked
email_account
=
_get_email_account
({
"enable_outgoing"
:
1
,
"enable_incoming"
:
1
,
"append_to"
:
append_to
})
if
not
email_account
and
sender_email_id
:
# check if the sender has email account with enable_outgoing
email_account
=
_get_email_account
({
"enable_outgoing"
:
1
,
"email_id"
:
sender_email_id
})
if
not
email_account
:
# sender don't have the outging email account
sender_email_id
=
None
email_account
=
get_default_outgoing_email_account
(
raise_exception_not_set
=
raise_exception_not_set
)
if
not
email_account
and
raise_exception_not_set
and
cint
(
frappe
.
db
.
get_single_value
(
'System Settings'
,
'setup_complete'
)):
...
...
@@ -65,9 +75,9 @@ def get_outgoing_email_account(raise_exception_not_set=True, append_to=None):
email_account
.
password
=
email_account
.
get_password
(
raise_exception
=
raise_exception
)
email_account
.
default_sender
=
email
.
utils
.
formataddr
((
email_account
.
name
,
email_account
.
get
(
"email_id"
)))
frappe
.
local
.
outgoing_email_account
[
append_to
or
"default"
]
=
email_account
frappe
.
local
.
outgoing_email_account
[
append_to
or
sender_email_id
or
"default"
]
=
email_account
return
frappe
.
local
.
outgoing_email_account
[
append_to
or
"default"
]
return
frappe
.
local
.
outgoing_email_account
[
append_to
or
sender_email_id
or
"default"
]
def
get_default_outgoing_email_account
(
raise_exception_not_set
=
True
):
'''conf should be like:
...
...
@@ -136,8 +146,8 @@ class SMTPServer:
else
:
self
.
setup_email_account
(
append_to
)
def
setup_email_account
(
self
,
append_to
=
None
):
self
.
email_account
=
get_outgoing_email_account
(
raise_exception_not_set
=
False
,
append_to
=
append_to
)
def
setup_email_account
(
self
,
append_to
=
None
,
sender
=
None
):
self
.
email_account
=
get_outgoing_email_account
(
raise_exception_not_set
=
False
,
append_to
=
append_to
,
sender
=
sender
)
if
self
.
email_account
:
self
.
server
=
self
.
email_account
.
smtp_server
self
.
login
=
getattr
(
self
.
email_account
,
"login_id"
,
None
)
or
self
.
email_account
.
email_id
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/form/controls/date_range.js
View file @
6afede2a
...
...
@@ -55,7 +55,7 @@ frappe.ui.form.ControlDateRange = frappe.ui.form.ControlData.extend({
if
(
value1
&&
value2
)
{
value1
=
frappe
.
datetime
.
str_to_user
(
value1
);
value2
=
frappe
.
datetime
.
str_to_user
(
value2
);
return
__
(
"
{0} to {1}
"
).
format
(
[
value1
,
value2
]);
return
__
(
"
{0} to {1}
"
,
[
value1
,
value2
]);
}
return
""
;
}
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/form/formatters.js
View file @
6afede2a
...
...
@@ -126,7 +126,7 @@ frappe.form.formatters = {
},
DateRange
:
function
(
value
)
{
if
(
$
.
isArray
(
value
))
{
return
__
(
"
{0} to {1}
"
).
format
(
[
return
__
(
"
{0} to {1}
"
,
[
frappe
.
datetime
.
str_to_user
(
value
[
0
]),
frappe
.
datetime
.
str_to_user
(
value
[
1
])
]);
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/ui/filters/filters.js
View file @
6afede2a
...
...
@@ -133,9 +133,8 @@ frappe.ui.FilterList = Class.extend({
for
(
var
i
in
this
.
filters
)
{
if
(
this
.
filters
[
i
].
field
)
{
var
f
=
this
.
filters
[
i
].
get_value
();
var
val
=
this
.
get_formatted_value
(
this
.
filters
[
i
].
field
,
f
[
3
]);
if
(
f
[
0
]
==
doctype
&&
f
[
1
]
==
fieldname
&&
f
[
2
]
==
condition
&&
val
==
value
)
{
if
(
f
[
0
]
==
doctype
&&
f
[
1
]
==
fieldname
&&
f
[
2
]
==
condition
&&
f
[
3
]
==
value
)
{
flag
=
true
;
}
else
if
(
$
.
isArray
(
value
)
&&
frappe
.
utils
.
arrays_equal
(
value
,
f
[
3
]))
{
flag
=
true
;
...
...
@@ -263,8 +262,7 @@ frappe.ui.Filter = Class.extend({
apply
:
function
()
{
var
f
=
this
.
get_value
();
this
.
flist
.
filters
.
pop
();
var
val
=
this
.
flist
.
get_formatted_value
(
this
.
field
,
f
[
3
]);
this
.
flist
.
push_new_filter
(
f
[
0
],
f
[
1
],
f
[
2
],
val
);
this
.
flist
.
push_new_filter
(
f
[
0
],
f
[
1
],
f
[
2
],
f
[
3
]);
this
.
wrapper
.
remove
();
},
...
...
This diff is collapsed.
Click to expand it.
frappe/public/js/frappe/ui/messages.js
View file @
6afede2a
...
...
@@ -26,7 +26,7 @@ frappe.confirm = function(message, ifyes, ifno) {
var
d
=
new
frappe
.
ui
.
Dialog
({
title
:
__
(
"
Confirm
"
),
fields
:
[
{
fieldtype
:
"
HTML
"
,
options
:
"
<p class=
'
frappe-confirm-message
'>
"
+
message
+
"
</p>
"
}
{
fieldtype
:
"
HTML
"
,
options
:
`
<p class=
"
frappe-confirm-message
">
${
message
}
</p>
`
}
],
primary_action_label
:
__
(
"
Yes
"
),
primary_action
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help