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
a781c3b9
Commit
a781c3b9
authored
9 years ago
by
Rushabh Mehta
Browse files
Options
Download
Plain Diff
Merge branch 'develop'
parents
78cbc930
8293d9dc
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
frappe/__version__.py
+1
-1
frappe/__version__.py
frappe/hooks.py
+1
-1
frappe/hooks.py
frappe/print/doctype/print_format/print_format.js
+11
-0
frappe/print/doctype/print_format/print_format.js
frappe/print/doctype/print_format/print_format.py
+14
-0
frappe/print/doctype/print_format/print_format.py
frappe/templates/pages/print.py
+14
-13
frappe/templates/pages/print.py
setup.py
+1
-1
setup.py
with
42 additions
and
16 deletions
+42
-16
frappe/__version__.py
View file @
a781c3b9
from
__future__
import
unicode_literals
__version__
=
"6.7.
6
"
__version__
=
"6.7.
7
"
This diff is collapsed.
Click to expand it.
frappe/hooks.py
View file @
a781c3b9
...
...
@@ -27,7 +27,7 @@ to ERPNext.
"""
app_icon
=
"octicon octicon-circuit-board"
app_version
=
"6.7.
6
"
app_version
=
"6.7.
7
"
app_color
=
"orange"
source_link
=
"https://github.com/frappe/frappe"
app_license
=
"MIT"
...
...
This diff is collapsed.
Click to expand it.
frappe/print/doctype/print_format/print_format.js
View file @
a781c3b9
...
...
@@ -13,6 +13,17 @@ frappe.ui.form.on("Print Format", "refresh", function(frm) {
if
(
frm
.
doc
.
standard
===
"
Yes
"
&&
user
!==
"
Administrator
"
)
{
frm
.
set_intro
(
__
(
"
Please duplicate this to make changes
"
));
}
if
(
!
frm
.
is_new
())
{
frm
.
add_custom_button
(
__
(
"
Make Default
"
),
function
()
{
frappe
.
call
({
method
:
"
frappe.print.doctype.print_format.print_format.make_default
"
,
args
:
{
name
:
frm
.
doc
.
name
}
})
})
}
});
frappe
.
ui
.
form
.
on
(
"
Print Format
"
,
"
edit_format
"
,
function
(
frm
)
{
...
...
This diff is collapsed.
Click to expand it.
frappe/print/doctype/print_format/print_format.py
View file @
a781c3b9
...
...
@@ -60,3 +60,17 @@ class PrintFormat(Document):
if
self
.
doc_type
:
frappe
.
clear_cache
(
doctype
=
self
.
doc_type
)
@
frappe
.
whitelist
()
def
make_default
(
name
):
frappe
.
has_permission
(
"Print Format"
,
"write"
)
print_format
=
frappe
.
get_doc
(
"Print Format"
,
name
)
frappe
.
make_property_setter
({
'doctype_or_field'
:
"DocType"
,
'doctype'
:
print_format
.
doc_type
,
'property'
:
"default_print_format"
,
'value'
:
name
,
})
frappe
.
msgprint
(
frappe
.
_
(
"Done"
))
This diff is collapsed.
Click to expand it.
frappe/templates/pages/print.py
View file @
a781c3b9
...
...
@@ -18,6 +18,7 @@ base_template_path = "templates/pages/print.html"
standard_format
=
"templates/print_formats/standard.html"
def
get_context
(
context
):
"""Build context for print"""
if
not
frappe
.
form_dict
.
doctype
or
not
frappe
.
form_dict
.
name
:
return
{
"body"
:
"""<h1>Error</h1>
...
...
@@ -28,7 +29,7 @@ def get_context(context):
doc
=
frappe
.
get_doc
(
frappe
.
form_dict
.
doctype
,
frappe
.
form_dict
.
name
)
meta
=
frappe
.
get_meta
(
doc
.
doctype
)
print_format
=
get_print_format_doc
()
print_format
=
get_print_format_doc
(
None
,
meta
=
meta
)
return
{
"body"
:
get_html
(
doc
,
print_format
=
print_format
,
...
...
@@ -39,13 +40,11 @@ def get_context(context):
"title"
:
doc
.
get
(
meta
.
title_field
)
if
meta
.
title_field
else
doc
.
name
}
def
get_print_format_doc
(
print_format_name
=
None
):
def
get_print_format_doc
(
print_format_name
,
meta
):
"""Returns print format document"""
if
not
print_format_name
:
print_format_name
=
frappe
.
form_dict
.
format
or
"Standard"
if
not
print_format_name
:
print_format_name
=
"Standard"
print_format_name
=
frappe
.
form_dict
.
format
\
or
meta
.
default_print_format
or
"Standard"
if
print_format_name
==
"Standard"
:
return
None
...
...
@@ -60,12 +59,6 @@ def get_html(doc, name=None, print_format=None, meta=None,
elif
no_letterhead
is
None
:
no_letterhead
=
not
cint
(
frappe
.
db
.
get_single_value
(
"Print Settings"
,
"with_letterhead"
))
if
isinstance
(
doc
,
basestring
)
and
isinstance
(
name
,
basestring
):
doc
=
frappe
.
get_doc
(
doc
,
name
)
if
isinstance
(
doc
,
basestring
):
doc
=
frappe
.
get_doc
(
json
.
loads
(
doc
))
doc
.
flags
.
in_print
=
True
if
not
frappe
.
flags
.
ignore_print_permissions
:
...
...
@@ -132,7 +125,15 @@ def get_html(doc, name=None, print_format=None, meta=None,
@
frappe
.
whitelist
()
def
get_html_and_style
(
doc
,
name
=
None
,
print_format
=
None
,
meta
=
None
,
no_letterhead
=
None
,
trigger_print
=
False
):
print_format
=
get_print_format_doc
(
print_format
)
"""Returns `html` and `style` of print format, used in PDF etc"""
if
isinstance
(
doc
,
basestring
)
and
isinstance
(
name
,
basestring
):
doc
=
frappe
.
get_doc
(
doc
,
name
)
if
isinstance
(
doc
,
basestring
):
doc
=
frappe
.
get_doc
(
json
.
loads
(
doc
))
print_format
=
get_print_format_doc
(
print_format
,
meta
=
meta
or
frappe
.
get_meta
(
doc
.
doctype
))
return
{
"html"
:
get_html
(
doc
,
name
=
name
,
print_format
=
print_format
,
meta
=
meta
,
no_letterhead
=
no_letterhead
,
trigger_print
=
trigger_print
),
...
...
This diff is collapsed.
Click to expand it.
setup.py
View file @
a781c3b9
from
setuptools
import
setup
,
find_packages
version
=
"6.7.
6
"
version
=
"6.7.
7
"
with
open
(
"requirements.txt"
,
"r"
)
as
f
:
install_requires
=
f
.
readlines
()
...
...
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