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
7a4787bb
Unverified
Commit
7a4787bb
authored
7 years ago
by
Ameya Shenoy
Browse files
Options
Download
Plain Diff
Merge branch 'hotfix'
parents
67fcbaa0
9a32f55f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
.travis.yml
+1
-0
.travis.yml
frappe/__init__.py
+1
-1
frappe/__init__.py
frappe/contacts/doctype/address/address.js
+4
-1
frappe/contacts/doctype/address/address.js
frappe/contacts/doctype/contact/contact.js
+4
-1
frappe/contacts/doctype/contact/contact.js
frappe/core/doctype/communication/communication.py
+13
-1
frappe/core/doctype/communication/communication.py
frappe/core/doctype/communication/test_communication.py
+26
-0
frappe/core/doctype/communication/test_communication.py
frappe/exceptions.py
+2
-0
frappe/exceptions.py
frappe/public/css/bootstrap.css
+0
-3
frappe/public/css/bootstrap.css
frappe/utils/jinja.py
+6
-5
frappe/utils/jinja.py
with
57 additions
and
12 deletions
+57
-12
.travis.yml
View file @
7a4787bb
...
...
@@ -33,6 +33,7 @@ before_script:
-
bench use test_site
-
bench reinstall --yes
-
bench setup-help
-
bench setup-global-help --mariadb_root_password travis
-
bench scheduler disable
-
sed -i 's/9000/9001/g' sites/common_site_config.json
-
bench start &
...
...
This diff is collapsed.
Click to expand it.
frappe/__init__.py
View file @
7a4787bb
...
...
@@ -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__
=
'10.1.3
2
'
__version__
=
'10.1.3
3
'
__title__
=
"Frappe Framework"
local
=
Local
()
...
...
This diff is collapsed.
Click to expand it.
frappe/contacts/doctype/address/address.js
View file @
7a4787bb
...
...
@@ -5,8 +5,11 @@ frappe.ui.form.on("Address", {
refresh
:
function
(
frm
)
{
if
(
frm
.
doc
.
__islocal
)
{
var
last_route
=
frappe
.
route_history
.
slice
(
-
2
,
-
1
)[
0
];
let
docname
=
last_route
[
2
];
if
(
last_route
.
length
>
3
)
docname
=
last_route
.
slice
(
2
).
join
(
"
/
"
);
if
(
frappe
.
dynamic_link
&&
frappe
.
dynamic_link
.
doc
&&
frappe
.
dynamic_link
.
doc
.
name
==
last_route
[
2
]
)
{
&&
frappe
.
dynamic_link
.
doc
.
name
==
docname
)
{
frm
.
add_child
(
'
links
'
,
{
link_doctype
:
frappe
.
dynamic_link
.
doctype
,
link_name
:
frappe
.
dynamic_link
.
doc
[
frappe
.
dynamic_link
.
fieldname
]
...
...
This diff is collapsed.
Click to expand it.
frappe/contacts/doctype/contact/contact.js
View file @
7a4787bb
...
...
@@ -7,8 +7,11 @@ frappe.ui.form.on("Contact", {
refresh
:
function
(
frm
)
{
if
(
frm
.
doc
.
__islocal
)
{
var
last_route
=
frappe
.
route_history
.
slice
(
-
2
,
-
1
)[
0
];
let
docname
=
last_route
[
2
];
if
(
last_route
.
length
>
3
)
docname
=
last_route
.
slice
(
2
).
join
(
"
/
"
);
if
(
frappe
.
dynamic_link
&&
frappe
.
dynamic_link
.
doc
&&
frappe
.
dynamic_link
.
doc
.
name
==
last_route
[
2
]
)
{
&&
frappe
.
dynamic_link
.
doc
.
name
==
docname
)
{
frm
.
add_child
(
'
links
'
,
{
link_doctype
:
frappe
.
dynamic_link
.
doctype
,
link_name
:
frappe
.
dynamic_link
.
doc
[
frappe
.
dynamic_link
.
fieldname
]
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/communication.py
View file @
7a4787bb
...
...
@@ -51,6 +51,18 @@ class Communication(Document):
frappe
.
throw
(
_
(
"Cannot create a {0} against a child document: {1}"
)
.
format
(
_
(
self
.
communication_type
),
_
(
self
.
reference_doctype
)))
# Prevent circular linking of Communication DocTypes
if
self
.
reference_doctype
==
"Communication"
:
circular_linking
=
False
doc
=
get_parent_doc
(
self
)
while
doc
.
reference_doctype
==
"Communication"
:
if
get_parent_doc
(
doc
).
name
==
self
.
name
:
circular_linking
=
True
break
doc
=
get_parent_doc
(
doc
)
if
circular_linking
:
frappe
.
throw
(
_
(
"Please make sure the Reference Communication Docs are not circularly linked."
),
frappe
.
CircularLinkingError
)
if
not
self
.
user
:
self
.
user
=
frappe
.
session
.
user
...
...
@@ -293,4 +305,4 @@ def get_permission_query_conditions_for_communication(user):
email_accounts
=
[
'"%s"'
%
account
.
get
(
"email_account"
)
for
account
in
accounts
]
return
"""tabCommunication.email_account in ({email_accounts})"""
\
.
format
(
email_accounts
=
','
.
join
(
email_accounts
))
\ No newline at end of file
.
format
(
email_accounts
=
','
.
join
(
email_accounts
))
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/test_communication.py
View file @
7a4787bb
...
...
@@ -43,3 +43,29 @@ class TestCommunication(unittest.TestCase):
for
x
in
invalid_email_list
:
self
.
assertFalse
(
frappe
.
utils
.
parse_addr
(
x
)[
0
])
def
test_circular_linking
(
self
):
content
=
"This was created to test circular linking"
a
=
frappe
.
get_doc
({
"doctype"
:
"Communication"
,
"communication_type"
:
"Communication"
,
"content"
:
content
,
}).
insert
()
b
=
frappe
.
get_doc
({
"doctype"
:
"Communication"
,
"communication_type"
:
"Communication"
,
"content"
:
content
,
"reference_doctype"
:
"Communication"
,
"reference_name"
:
a
.
name
}).
insert
()
c
=
frappe
.
get_doc
({
"doctype"
:
"Communication"
,
"communication_type"
:
"Communication"
,
"content"
:
content
,
"reference_doctype"
:
"Communication"
,
"reference_name"
:
b
.
name
}).
insert
()
a
=
frappe
.
get_doc
(
"Communication"
,
a
.
name
)
a
.
reference_doctype
=
"Communication"
a
.
reference_name
=
c
.
name
self
.
assertRaises
(
frappe
.
CircularLinkingError
,
a
.
save
)
This diff is collapsed.
Click to expand it.
frappe/exceptions.py
View file @
7a4787bb
...
...
@@ -82,3 +82,5 @@ class IncorrectSitePath(NotFound): pass
class
ImplicitCommitError
(
ValidationError
):
pass
class
RetryBackgroundJobError
(
Exception
):
pass
class
DocumentLockedError
(
ValidationError
):
pass
class
CircularLinkingError
(
ValidationError
):
pass
This diff is collapsed.
Click to expand it.
frappe/public/css/bootstrap.css
View file @
7a4787bb
...
...
@@ -203,9 +203,6 @@ th {
a
:visited
{
text-decoration
:
underline
;
}
a
[
href
]
:after
{
content
:
" ("
attr
(
href
)
")"
;
}
abbr
[
title
]
:after
{
content
:
" ("
attr
(
title
)
")"
;
}
...
...
This diff is collapsed.
Click to expand it.
frappe/utils/jinja.py
View file @
7a4787bb
...
...
@@ -156,11 +156,12 @@ def get_allowed_functions_for_jenv():
"escape"
:
frappe
.
db
.
escape
,
}
# load jenv methods from hooks.py
for
app
in
frappe
.
get_installed_apps
():
for
jenv_method
in
frappe
.
get_hooks
(
app_name
=
app
).
get
(
'jenv'
,
{
"methods"
:
[]})[
"methods"
]:
method_name
,
method_definition
=
jenv_method
.
split
(
":"
)
out
[
method_name
]
=
frappe
.
get_attr
(
method_definition
)
if
getattr
(
frappe
.
local
,
"site"
,
None
):
# load jenv methods from hooks.py
for
app
in
frappe
.
get_installed_apps
():
for
jenv_method
in
frappe
.
get_hooks
(
app_name
=
app
).
get
(
'jenv'
,
{
"methods"
:
[]})[
"methods"
]:
method_name
,
method_definition
=
jenv_method
.
split
(
":"
)
out
[
method_name
]
=
frappe
.
get_attr
(
method_definition
)
return
out
...
...
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