Skip to Content
Menu
This question has been flagged
2 Replies
766 Views

I am trying to add QR code in the Invoice pdf. I am not an expert in odoo or python but have a basic knowledge for editing the exiting code.


For adding the QR code in Invoice I have edited the view report_invoice_document under Technical->user Interface->Views and added the following line for generating QR code.



The above code generates a QR Code which has the text upi:/pay

The QRcode is getting generated but the link in QR Code is truncated. 


In case I use upi:/ instead of upi:// as shown below full link is getting generated.



How to get the full link with upi:// ?


Avatar
Discard
Author Best Answer

  q

Avatar
Discard
Best Answer

Try the following code

<img t-att-src=”’/report/barcode/QR/’ + ‘upi:/’ + ‘/’ + ‘pay……..’>


To include // after upi: in an HTML attribute, you need to properly escape the characters so that they are interpreted correctly. In HTML, the colon (:) and slashes (/) have special meanings, so they need to be represented by their corresponding HTML entities.



Avatar
Discard
Author

Now upi:// is coming in the QR code but the ? after pay is creating an issue. the QR code now contains only upi://pay and the string followed by ? is getting dropped.