-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
688 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import frappe | ||
|
||
from print_designer.patches.patch_utils import patch_formats | ||
|
||
|
||
def execute(): | ||
"""Modify Formats to work with New Column Style Feature""" | ||
|
||
def element_callback(el): | ||
el["selectedColumn"] = None | ||
for col in el["columns"]: | ||
col["style"] = {} | ||
col["applyStyleToHeader"] = False | ||
|
||
patch_formats( | ||
{"element": element_callback}, | ||
types=["table"], | ||
) |
17 changes: 17 additions & 0 deletions
17
print_designer/patches/introduce_suffix_dynamic_content.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import frappe | ||
|
||
from print_designer.patches.patch_utils import patch_formats | ||
|
||
|
||
def execute(): | ||
"""Introduce suffix to dynamic content elements""" | ||
|
||
def dynamic_content_callback(el): | ||
if not el.get("is_static", True): | ||
if not "suffix" in el: | ||
el["suffix"] = None | ||
|
||
patch_formats( | ||
{"dynamic_content": dynamic_content_callback}, | ||
types=["text", "table"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import frappe | ||
|
||
from print_designer.patches.patch_utils import patch_formats | ||
|
||
|
||
def execute(): | ||
"""Add altStyle object for alternate rows in table elements and in globalStyles of print formats that uses print designer""" | ||
print_formats = frappe.get_all( | ||
"Print Format", | ||
filters={"print_designer": 1}, | ||
fields=["name", "print_designer_settings"], | ||
as_list=1, | ||
) | ||
for pf in print_formats: | ||
settings = frappe.parse_json(pf[1]) | ||
if settings: | ||
# If globalStyles is not present, skip | ||
if not (gs := settings.get("globalStyles")): | ||
continue | ||
|
||
gs["table"]["altStyle"] = {} | ||
frappe.db.set_value("Print Format", pf[0], "print_designer_settings", frappe.as_json(settings)) | ||
|
||
def element_callback(el): | ||
el["altStyle"] = {} | ||
|
||
patch_formats( | ||
{"element": element_callback}, | ||
types=["table"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
print_designer/print_designer/client_scripts/point_of_sale.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// overrides the print util function that is used in the point of sale page. | ||
// we should ideally change util function in framework to extend it. this is workaround until that. | ||
const original_util = frappe.utils.print; | ||
frappe.utils.print = (doctype, docname, print_format, letterhead, lang_code) => { | ||
if (frappe.model.get_value("Print Format", print_format, "print_designer")) { | ||
let w = window.open( | ||
frappe.urllib.get_full_url( | ||
"/app/print/" + | ||
encodeURIComponent(doctype) + | ||
"/" + | ||
encodeURIComponent(docname) + | ||
"?format=" + | ||
encodeURIComponent(print_format) + | ||
"&no_letterhead=0" + | ||
"&trigger_print=1" + | ||
(lang_code ? "&_lang=" + lang_code : "") | ||
) | ||
); | ||
if (!w) { | ||
frappe.msgprint(__("Please enable pop-ups")); | ||
return; | ||
} | ||
} else { | ||
original_util(doctype, docname, print_format, letterhead, lang_code); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.