frappe / print_designer

Visual print designer for Frappe / ERPNext
GNU Affero General Public License v3.0
179 stars 101 forks source link

custom HTML code not set on header or footer #282

Closed vijaygajera closed 1 week ago

vijaygajera commented 2 weeks ago

I want to add E-invoice QR code in header part of my sales invoice print format , but i can't set on header i add my custome block in manage custome data , its show qr code just below header how can set in header or footer My code is : {% if doc.irn %} {% set e_invoice_log = frappe.db.get_value( "e-Invoice Log", doc.irn, ("invoice_data", "signed_qr_code"), as_dict=True ) %}

{%- set invoice_data = dict(json.loads(e_invoice_log.invoice_data)) -%}

{{ web_block('e-Invoice QR Code', values={'qr_text': e_invoice_log.signed_qr_code }) }} {% endif %}

maharshivpatel commented 1 week ago

@vijaygajera can you share the format and what is the issue. screenshots or video will help a lot investigate.

vijaygajera commented 1 week ago

screen-capture.webm

This code for print E-invoice qr code i want to print this qr on header area my code is printed but i can't set it

Please check the documentation of Add e-Invoice QR Code in Print Formats

I use this code : {% if doc.irn %} {% set e_invoice_log = frappe.db.get_value( "e-Invoice Log", doc.irn, ("invoice_data", "signed_qr_code"), as_dict=True ) %} {%- set invoice_data = dict(json.loads(e_invoice_log.invoice_data)) -%} {{ web_block('e-Invoice QR Code', values={'qr_text': e_invoice_log.signed_qr_code }) }} {% endif %}

maharshivpatel commented 1 week ago

@vijaygajera this is how you define data https://github.com/frappe/print_designer/pull/115#issue-2051319393

basically in your case modify like

% if doc.irn %}

    {% set e_invoice_log = frappe.db.get_value(
     "e-Invoice Log", doc.irn, ("invoice_data", "signed_qr_code"), as_dict=True
    ) %}
    {%- set invoice_data = dict(json.loads(e_invoice_log.invoice_data)) -%}

    {% set send_to_jinja = {
        "e_invoice_log": e_invoice_log,
        "invoice_data": invoice_data,
    } %}

{% endif %}

then in format you use those variable https://github.com/frappe/print_designer/pull/99

in your case just draw with barcode tool and add below value.

{%- if e_invoice_log -%}{{ e_invoice_log.signed_qr_code }}{%- endif -%}

E-invoice Barcode

maharshivpatel commented 1 week ago

@vijaygajera i hope this solves your issue. let me know if you face any other issue

vijaygajera commented 1 week ago

Now Its Workings, Thanks