ERPGulf / zatca_erpgulf

Implementation of Zatca Phase-2 E-Invoicing - for FrappeCLoud
MIT License
14 stars 10 forks source link

Error in qrcode from xml: The data will not fit inside a version-15 code. #8

Closed Craftint closed 3 weeks ago

Craftint commented 3 weeks ago

While submitting invoice, zatca clearance is happening and xml is generated as well. But there is issue with qr code: Error in qrcode from xml: The data will not fit inside a version-15 code with the given encoding and error level (the code must be at least a version16) image

Due to size, we are having trouble generating qr code. if we increase version here, it is working fine:

`def attach_QR_Image(qrCodeB64,sales_invoice_doc): try: qr = pyqrcode.create(qrCodeB64, error='L', version=15, mode='binary') temp_file_path = "qr_code.png" qr_image=qr.png(temp_file_path, scale=15) file = frappe.get_doc({ "doctype": "File", "file_name": f"QRimage{sales_invoice_doc.name}.png", "attached_to_doctype": sales_invoice_doc.doctype, "attached_to_name": sales_invoice_doc.name, "content": open(temp_file_path, "rb").read()

                    })
                    file.save(ignore_permissions=True)
                except Exception as e:
                    frappe.throw("error in qrcode from xml:  " + str(e) )

`

Can you update it in core, so that it can be helpful

fkalpana commented 3 weeks ago

Thanks , corrected and pushed. Appreciate your support.

Craftint commented 3 weeks ago

Thanks for the quick action!