From 0d316c178612f893e9e8e67a4599baa3a4a8f6ac Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Tue, 30 Aug 2022 12:56:41 -0400 Subject: [PATCH] feat: add example print format --- check_run/check_run/print_format/__init__.py | 0 .../print_format/example_voucher/__init__.py | 0 .../example_voucher/example_voucher.json | 26 +++++++++++++++++++ check_run/hooks.py | 6 +++++ 4 files changed, 32 insertions(+) create mode 100644 check_run/check_run/print_format/__init__.py create mode 100644 check_run/check_run/print_format/example_voucher/__init__.py create mode 100644 check_run/check_run/print_format/example_voucher/example_voucher.json diff --git a/check_run/check_run/print_format/__init__.py b/check_run/check_run/print_format/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/check_run/check_run/print_format/example_voucher/__init__.py b/check_run/check_run/print_format/example_voucher/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/check_run/check_run/print_format/example_voucher/example_voucher.json b/check_run/check_run/print_format/example_voucher/example_voucher.json new file mode 100644 index 00000000..bf504844 --- /dev/null +++ b/check_run/check_run/print_format/example_voucher/example_voucher.json @@ -0,0 +1,26 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2022-08-30 12:27:45.736571", + "css": "@font-face {\n font-family: 'EntezareZohoor2';\n src: url('fonts/EntezareZohoor2.eot'), url('fonts/EntezareZohoor2.ttf') format('truetype'), url('fonts/EntezareZohoor2.svg') format('svg');\n font-weight: normal;\n font-style: normal;\n}\n\n.print-format {\n\tpadding: 0px;\n}\n@media screen {\n\t.print-format {\n\t\tpadding: 0in;\n\t}\n}\n#payer_check_window_block {\n top: 0.7cm; \n left: 0.7cm;\n height: 2.2cm;\n width: 8.8cm;\n position: absolute;\n \n}\n\n#payer_name_block{\n top: 0.1cm; \n left: 1cm;\n position: absolute;\n}\n\n#payee_address_window_block {\n top:4.9cm;\n left: 1.9cm;\n position: absolute; \n width: 8.8cm; \n height:2.2cm;\n}\n\n#address_block{\n top: 0.2cm; \n left: 0.2cm;\n position: relative;\n}\n\n\n\n#memo_block {\n top:7.1cm;\n left: 2cm;\n position: absolute; \n width: 6cm;\n}\n\n\n#check_section_1 {\n font-size: 15px;\n width:20.0cm;\n height:8.9cm;\n}\n\n#check_section_2 {\n height:8.9cm;\n}\n\n#check_section_3 {\n height:8.9cm;\n}\n\n\n#payer_name_block {\ntext-align: center; \n\n}\n\n#payer_name_block {\nwidth:4cm;\ntext-align: center; \nposition: absolute;\n}\n\n#bank_info_block {\nfont-size: 10px;\nwidth:2.5cm;\nheight:1.8cm;\ntext-align: center; \nposition: absolute;\n}\n\n\n#payment_in_words_block {\n font-size: 13px;\n}\n\n#memo_block {\nfont-size: 10px;\n}\n\n#signature_block {\ncolor: blue;\nfont-family: cursive;\n\n}\n#payment_amount_block{\n top:3.3cm;\n left: 17.6cm;\n\tposition: absolute; \n\tmin-width: 4cm;\n\n}\n\n.payment_reference_block {\npadding-left:1cm; \npadding-right:1cm; \n}\n\n.payment_name_cell {\ntext-align: right; \n}\n\n#payment_amount_number_block {\n top:3.3cm;\n left: 17.6cm;\n\tposition: absolute; \n\tmin-width: 4cm;\n}\n\n\n.right_stamp {\n top:2.8cm;\n left: 16.6cm;\n width: 3cm;\n\theight: 1.5cm;\n\tfont-size: 40px;\n \tfort-weight: bold;\n position: absolute; \n}\n\n.sig_stamp {\n top:6.3cm;\n left: 13.8cm;\n width: 3cm;\n\theight: 1.5cm;\n\tfont-size: 40px;\n \tfort-weight: bold;\n position: absolute; \n}\n\n.big_stamp {\n top:2.8cm;\n left: 6.1cm;\n width: 7cm;\n\theight: 3cm;\n\tfont-size: 80px;\n \tfort-weight: bold;\n position: absolute; \n}\n\n\n.stamp {\n\tmargin: 0px;\n\toverflow: hidden;\n display: flex;\n justify-content: space-around;\n align-items: center;\n vertical-align: middle;\n text-align: center;\n\n flex-direction: row;\n color: #555;\n\tfont-weight: 700;\n\tborder: 0.25rem solid #555;\n\tdisplay: inline-block;\n\t\n\ttext-transform: uppercase;\n\tborder-radius: 1rem;\n\tfont-family: 'Courier';\n\t-webkit-mask-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/8399/grunge.png');\n -webkit-mask-size: 944px 604px;\n mix-blend-mode: multiply;\n}\n\n\n.is-nope {\n color: #ff5858;\n border: 0.5rem double #D23;\n \t-webkit-mask-position: 2rem 3rem;\n \t\n \n}\n\n.is-draft {\n\tcolor: #ff5858;\n\tborder: 1rem double #ff5858;\n font-size: 6rem;\n font-family: \"Open sans\", Helvetica, Arial, sans-serif;\n border-radius: 0;\n padding: 0.5rem;\n} ", + "custom_format": 1, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "html": "
\n \n\t
\n\t {% if doc.docstatus == 0 %}\n VOID DRAFT\n VOID DRAFT\n {% elif doc.docstatus == 2 or overwrite_void %}\n VOID\n VOID\n VOID\n {% endif %}\n\t \n\t
\n\t\t\n\t\t\t{{ doc.company }}\n\t\t\n\t\t
\n\t\t\n\t\t {{ doc.get_formatted('posting_date') }} \n\t\t\n\n\t\t\n\t\t\t{{ doc.party_name }}\n\t\t\n\t\t\n\t\t\n\t
\n\t {{ doc.party_name }}
\n\t {% set address = get_default_address(doc.party_type, doc.party) %}\n\t\t\t{% if address %}\n\t\t\t {{ frappe.get_doc('Address', address).get_display() }}\n\t\t\t{% endif %}\n\t\t\t
\n\t\t
\n\t\t\n\t\t\n\t\t\t{% set money_number = doc.get_formatted('paid_amount')[1:].strip() %} \n\t\t\t\n\t\t\t{% if money_number|length < 18 %}\n\t\t\t\t {% set money_number = ( money_number + '***************************')[:18] %}\n\t\t\t{% endif %}\n\t\t\t{{ money_number }}\n\t\t\n\t\t\n\t\t\t\t{% set money_in_words = frappe.utils.money_in_words(doc.paid_amount)[:-5] %}\n\t\t\t\t{% if money_in_words|length < 90 %}\n\t\t\t\t {% set money_in_words = (money_in_words + '************************************************************************')[:100] %}\n\t\t\t\t{% endif %}\n\t\t\t\t{{ money_in_words }}\n\t\t\n\t\t\n\t\t\n\t\t\t{{ doc.check_memo or '' }} {% if test_lines %} MEMO {% endif %}\n\t\t\n\n\t\t\n\t\t SIGNATURE\n\n\t\t\n \n\t\t\tCHECK#\n\t\t\n\t\t\t\t\n\t\t\tACCOUNT NUMBER {{ doc.account_no or '' }}\n\t\t\n\t\t\n\t\t\tROUTING_NUMBER\n\t\t\n\t
\n
\n{% for i in range(0,2) %}\n {% if i == 0 %}\n
\n {% endif %}\n {% if i == 1 %}\n
\n {% endif %}\n
\n\n\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t{% for reference in doc.references %}\n\t\t\t\t\t\t\n\t\t\t\t\t\t {% if reference.reference_doctype == 'Purchase Invoice' %}\n\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t\t\t{% elif reference.reference_doctype == 'Sales Invoice' %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t {% elif reference.reference_doctype == 'Expense Claim' %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t {% elif reference.reference_doctype == 'Journal Entry' %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\t{% endif %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t{% endfor %}\n\t\t\t\t
{{doc.party_name}} {{ frappe.utils.formatdate(doc.reference_date) or '' }} {{doc.get_formatted(\"base_paid_amount\")}}
Date Reference Amount Payment
{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"bill_date\")) or \"\"}} {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"bill_no\") or \"\" }}{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"po_date\")) or \"\"}} {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"po_no\") or \"\" }}{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"expense_report_date\")) or \" \"}} {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"name\") or \" \" }} {{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"posting_date\")) or \" \"}} {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, \"name\") or \" \" }} {{ frappe.utils.fmt_money(reference.get_formatted('total_amount'), 2, 'USD')}} {{ reference.get_formatted('allocated_amount')}}
\n
\n
\n{% endfor %}", + "idx": 0, + "line_breaks": 0, + "modified": "2022-08-30 12:53:44.237325", + "modified_by": "Administrator", + "module": "Check Run", + "name": "Example Voucher", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/check_run/hooks.py b/check_run/hooks.py index f2256871..d5412f8c 100644 --- a/check_run/hooks.py +++ b/check_run/hooks.py @@ -173,3 +173,9 @@ # Recommended only for DocTypes which have limited documents with untranslated names # For example: Role, Gender, etc. # translated_search_doctypes = [] + +jenv = { + "methods": [ + "get_default_address:frappe.contacts.doctype.address.address.get_default_address" + ] +} \ No newline at end of file