How to add TAX ID in Sales Invoice Print Out

Hello,

I’m trying to add TAX ID of the Customer in Sales Invoice Report Form Printout. But my query/script is not working.

I’ve tried this one

  1. {%- for row in doc.Customer-%}
    {{ row.customer}}
    {% set u= frappe.get_doc (“Customer”,row.tax_id)%}
    {{u.tax_id}}
    {%- endfor -%}

  2. {%- for row in doc.Sales_Invoice-%}
    {{ row.customer}}
    {% set u= frappe.get_doc (“Customer”,row.customer)%}
    {{u.tax_id}}
    {%- endfor -%}

  3. {%- for row in doc.Sales_Invoice-%}
    {{ row.customer}}
    {% set u= frappe.get_doc (“Customer”,row.tax_id)%}
    {{u.tax_id}}
    {%- endfor -%}

and still not working. Need help in adding TAX ID in Sales Invoice. Thank you

Please check the following thread

Hi @ossphinc,

instead of frappe.get_doc use the frappe.db.get_value to get the tax_id from customer. following is the syntax for the frappe.db.get_value

{{ frappe.db.get_value(“Customer”, doc.customer, “tax_id” }}

Thanks,
Makarand

@Pawan @makarand_b Thank you so much. It is working already. Thank you