Print e-invoice details on custom print format


how do i print this e-invoice transaction details in my personal custom print format. Editing the e-invoice format doesnt work.

Pls. review relevant Github issue:

2 Likes

Please post full traceback (copy error to clipboard).

Copy error to clipboard doesnt work.

does this help

pls help how to print the transaction detail like irn, ack. no. etc. above code only print qrcode.

Hello,

You can refer to the below link:

Also, You can refer to the current implementation:

2 Likes

Thanks perfectly working.

I tried using the below HTML tag (copied from docs) and still getting the same error-

<img src="data:image/png;base64,{{ get_qr_code(einvoice.signed_qr_code, scale=2) }}" class="qrcode">

image

Stack trace is below-

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 95, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 47, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1603, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/client.py”, line 189, in set_value
doc.save()
File “apps/frappe/frappe/model/document.py”, line 305, in save
return self._save(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 340, in _save
self.run_before_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1029, in run_before_save_methods
self.run_method(“validate”)
File “apps/frappe/frappe/model/document.py”, line 899, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1251, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1233, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/document.py”, line 896, in fn
return method_object(args, *kwargs)
File “apps/frappe/frappe/printing/doctype/print_format/print_format.py”, line 40, in validate
self.extract_images()
File “apps/frappe/frappe/printing/doctype/print_format/print_format.py”, line 64, in extract_images
df[“options”] = extract_images_from_html(self, df[“options”])
File “apps/frappe/frappe/core/doctype/file/utils.py”, line 270, in extract_images_from_html
content = re.sub(r’<img[^>]src\s=\s
"'(.
?)[“']', _save_file, content)
File “/usr/lib/python3.10/re.py”, line 209, in sub
return _compile(pattern, flags).sub(repl, string, count)
File “apps/frappe/frappe/core/doctype/file/utils.py”, line 227, in _save_file
headers, content = data.split(”,")
ValueError: too many values to unpack (expected 2)

@amrit-citrusleaf ,Try This: {{ web_block(‘E-Invoice QR Code’, values={‘qr_text’: e_invoice_log.signed_qr_code }) }}

@Krishn - apologies for the late reply but I am getting this error when using web_block-
image

I got it working. Need to follow the exact steps as given on Guide to Add e-Invoice QR Code in Print Formats | India Compliance