frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.04k stars 7.21k forks source link

Can't Generate QRcode on Invoice #36456

Open SmoothPlay opened 1 year ago

SmoothPlay commented 1 year ago

Information about bug

Hey guys,

Even after following this documentation "https://docs.erpnext.com/docs/user/manual/en/qr-code-in-custom-print-format" QRcode still doesn't show up when choosing the Print Template.

Is there any dependency that needs to be installed in order for Erpnext to render a QRcode?

How can we test it out?

Module

regional

Version

Frappe Version 14 Erpnext Version 14

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

nitin-anantpranali commented 1 year ago

Yes, I am also facing issue... Any resolution?

mustakimgodil commented 1 year ago

I tried this and it worked,

Don't create web template and instead replace

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

with

{%- set imgsrc = "data:image/png;base64," + get_qr_code(e_invoice_log.signed_qr_code) -%}
    <img src={{imgsrc}} class="qrcode">

so your new code will be

{% 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)) -%}

<h5 class="section-heading"><b>Transaction Details</b></h5>
<div class="row section-break info-section">
<div class="col-xs-8 column-break">
    {%
        set transaction_details = {
            "IRN": invoice_data.Irn,
            "Ack. No": invoice_data.AckNo,
            "Ack. Date": frappe.utils.format_datetime(
                invoice_data.AckDt, "dd/MM/yyyy hh:mm:ss"
            ),
            "Category": invoice_data.TranDtls.SupTyp,
            "Document Type": invoice_data.DocDtls.Typ,
            "Document No": invoice_data.DocDtls.No,
        }
    %}
    {% for key, value in transaction_details.items() %}
        <div class="row data-field">
<div class="col-xs-4"><label>{{ key }}</label></div>
<div class="col-xs-8 value">{{ value }}</div>
</div>
    {% endfor %}
</div>
<div class="col-xs-4 column-break text-right">
    {%- set imgsrc = "data:image/png;base64," + get_qr_code(e_invoice_log.signed_qr_code) -%}
    <img src={{imgsrc}} class="qrcode">
</div>
</div>
<hr/>
{% endif %}
AjayKumar82191 commented 11 months ago

bro when i am try to genrate e-invoice.irn number is genrated but qr code code not.when i am checking in json it json in signed_qr_code value it shows null.