Fetch data from item to sales invoice print format

Hello everybody
I am trying to customize a print format for sales invoice . I add a custom field in item doctype called package and I want to show this in the sales invoice printing form but all i have is none
this is a screen for my code .
Any help in this

@yara Is the custom field in a Child Table?
If so, based on your code, you are already inside the loop for the Child Table rows so the code can be as simple as this.

<td style="text-align: center">{{row.package}}</td>

thank you for your replay but no the custom field is in item doctype and when i try the code you posted i have an error
{{ no such element: erpnext.accounts.doctype.sales_invoice_item.sales_invoice_item.SalesInvoiceItem object[‘package’] }}

@yara I believe the name of the item is row.name not doc.name

Hi @yara,

Please apply/try it.

{{ frappe.db.get_value("Item",{"item_code": row.item_code},'package') }}

Then reload and check it.

Thank You!

1 Like

thank you very much it is work