So I am trying to add a custom field to sales invoice.
Now fields are already created.
I insert html editor in the builder and for example where I want to show the customer vat id I use {{ doc.tax_id }}
With that I get the error {{ no such element: erpnext.accounts.doctype.sales_invoice.sales_invoice.SalesInvoice object[‘tax_id’] }}
Just try {{ tax_id }}. If Sales Invoice has field called tax_id, then it’s value should be fetched correctly in the text editor field. Hope this helps.
{{ no such element: erpnext.accounts.doctype.sales_invoice.sales_invoice.SalesInvoice object[‘tax_id’] }}
Just to clarify I have added custom fields within Customer template (tax_id already existed) and I am editing the print layout and adding html elements with above code. I have touched nothing else.
If you have added the tax_id field in Customer and you are trying to access that field in Sales Invoice then you should use the frappe.db.get_value method to fetch the tax_id in your Custom Print Format.
e.g. {{ frappe.db.get_value("Customer", doc.customer, "tax_id") or "" }}