Print Company and Customer Tax ID in sales invoice

This is a very important and legal requirement to print company and customer VAT number in invoice.

I am not finding to include this field in print format

Can some body please help

Hello @gpnath,

you can do this by create your custom print format.
By this feature you can add all things which is you required and also able make design as per your requirement

Refer this post
https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master.html

thank you … I managed to add this in Sales Invoice using custom field and custom script but it is not appearning the Print format … triend print hide uncheck no help

@gpnath Can you see value in Sales Invoice form?

You can also print using custom html, drag and drop custom html.

write {{ doc.tax_id }} in custom html

Thank it is working

1 Like

{{ doc.tax_id }} in custom html is not working for me. I get this error:

{{ no such element: erpnext.accounts.doctype.sales_invoice.sales_invoice.SalesInvoice object['tax_id'] }}```

I would really appreciate any help.

Thanks!

Hey Guys,
I am traying now for 2 hours to add hte customers tax id to my invoices, with no success. Can anybody explain just step by step how to do it?

I tried to create a custom field as in the description above. The field showed up in my invoice from customization panel but has no effect, what did I do wrong? see the screenshot

I also tried to add the script as described here:
https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/custom-script-fetch-values-from-master.html

no effect :frowning:

Can anybody help me? i am relatively new to erpnext and it takes always some time to figure out how get things running, but this time I am a bit lost :frowning:

try this
{{ frappe.db.get_value(“Customer”, doc.customer, “vat_id”) }}

1 Like

Help needed!!
I am a newbee and try to input the extrem important data of Tax - I mean the vatnumber, no idea how, tried to follow the comments above, but there are some breaks in the steps, so I can’t follow the steps so I am not successful.

version {{ frappe.db.get_value(“Customer”, doc.customer, “vat_id”) }}

version cur_frm.add_fetch(‘customer’,‘vat_id’,‘vat_id’)

how to get terms and condition on next page when I print (pdf) the invoice?

cheers and thank you
Daniel

hi, thanks for your help but If I put your line into the script, it totally fails as you can see in the attachment. is there anybody able to fix this for me? even paying? xD

Here are steps how I made it work with custom field for vat number:

Please note that I have added the field “vatnumberat customer master data! (Go to Customer , then Customize, then add row at the end with ID vatnumber and type data. Save. Refresh.)

Then in my sales invoice form I have added a customer HTML with the following code and it works:
{{ frappe.db.get_value("Customer", doc.customer, "vatnumber") }}
And it returns the value of the new field “vatnumber” from my customer record (note: NOT sales invoice, but customer master record!!!).

1 Like

Could you write it step by step, I wasn’t successful
:frowning:

Hi,

the default value is tax_id

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

when using this, this error appears:

{{ no such element: erpnext.selling.doctype.quotation.quotation.Quotation object[‘tax_id’] }}

We have done this totally in the print format, without any code change
In the print screen for invoices. click the Customise button, then drag the tax field from the left onto the format area.

do you mean you have something like a WYSIWYG editor? When editing a print format, no fields appear to the left.

try this

  • Create an invoice and save it
  • Click the print icon
  • On the print page, select customise
  • Look for the fields on the left
  • Drag and drop as you see fit

https://erpnext.com/docs/user/manual/en/customize-erpnext/print-format

1 Like

The problem is that I need this in quotation print format, not invoice print format. In fact, this is the error:

{{ no such element: erpnext.selling.doctype.quotation.quotation.Quotation object[‘tax_id’] }}

It seems in quotation that field is not available, but when using

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

Tax Id of other customer appears when previewing the quotation. When displaying the PDF, tax id appears empty.

We ran into the same issue. The Tax ID was printing fine with Sales Invoices and it showed up when previewing the Quotation.

The issue is that in a quotation the receiving party is not always a customer. My solution is as follows:

{{ frappe.db.get_value("Customer", doc.party_name, "tax_id") }}

note the doc.party_name instead of doc.customer

In our case this shows the Tax ID on the printed quotation as well.