Have to customise Saudi invoice qr code.
While scanning Invoice with E-invoicing QR reader app,If currency is not SAR also it showing SAR only.Date format also not changing.
def get_qr_encoding(tag, field):
company_name_byte_array = field.encode()
company_name_tag_encoding = tag.to_bytes(length=1, byteorder='big')
company_name_length_encoding = len(company_name_byte_array).to_bytes(length=1, byteorder='big')
return company_name_tag_encoding + company_name_length_encoding + company_name_byte_array
for record in self:
qr_code_str = ''
if record.invoice_date and record.company_id.vat and record.l10n_sa_confirmation_datetime:
seller_name_enc = get_qr_encoding(1, record.company_id.display_name)
company_vat_enc = get_qr_encoding(2, record.company_id.vat)
confirmation_time = fields.Datetime.context_timestamp(self.with_context(tz='Asia/Riyadh'),
record.l10n_sa_confirmation_datetime)
confirmation_time_str = datetime.strftime(confirmation_time, "%H:%M:%S") # convert into string
time_sa1 = datetime.strftime(record.invoice_date,"%Y/%m/%d")
latest_dt =str(time_sa1) + ' ' + confirmation_time_str
timestamp_enc111 = get_qr_encoding(3, confirmation_time_str)
timestamp_enc = get_qr_encoding(3, latest_dt)
invoice_total_enc = get_qr_encoding(4, float_repr(abs(record.amount_total_signed), 2))
total_vat_enc = get_qr_encoding(5, float_repr(abs(record.amount_tax_signed), 2))
str_to_encode = seller_name_enc + company_vat_enc + timestamp_enc + invoice_total_enc + total_vat_enc
qr_code_str = base64.b64encode(str_to_encode).decode()
record.l10n_sa_qr_code_str = qr_code_str
See here i gave date format as Year/month/date but its taking as Date/month/year :(
Can someone help me ?