Invoice translate

I would like to change the text Sales Invoice in the heading of my invoice template.

What jinja code should I use? I tried with {{ doc.type }} but it doesnt work.

I want the Sales invoice to be translated to Facture de vente in french.
With the default invoice template it’s tranlated but not in a custom one.
Thanks

@Samuel_Gervais,

To translate the message or field value you will need to use the _(msg, lang=None) method.
Where msg will be your field value and lang is language code available in frappe.

e.g. {{ _(doc.type) }}

If lang is not provided then system will take the user’s default language to translate.

Thanks,
Makarand

Thanks for the info.

But {{ _(doc.type) }} returns: {{ NO SUCH ELEMENT: ERPNEXT.ACCOUNTS.DOCTYPE.SALES_INVOICE.SALES_INVOICE.SALESINVOICE OBJE

@Samuel_Gervais,

You forgot to include the method _ (underscore) before brackets {{ _(doc.type )}}

Also make sure Sales Invoice contains the field with fieldname type.

Thanks,
Makarand

yes I included the underscore. It was only a typo error here.

How do I know if the Sales Invoice contains the field type? Can I add it if it’s not the case because it still doesnt work.

Thanks

@Samuel_Gervais,

You can check the form fields and its property in Customize Form.

Go To Explore > Setup > Customize > Customize Form

select the document which you wish to check, You can also add the custom fields from Customize the form.

https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/customize-form

Thanks,
Makarand