Using Custom Field on top of the Sales Invoice

Hi,
I tried searching the forum for this but didnt find any replies which helped.

I recently updated manager to the latest release and noticed that in sales invoice the order no field has been removed.
I actually had renamed the field and used it to mention the dispatch slip no.

Now since its not available I am unable to mention it near the invoice no.

I tried using the custom fields but that is also coming on the bottom of the sales invoice

I know it can be done using programming language and i know a bit of it. But to use a particular custom field i need to know what its called internally. Since when we create the custom field it only shows us what we have used and not what its internally called.

Can any one help me with this. I just need a custom field on top along with the Invoice no.

You don’t have to develop a theme to move custom fields to the top of the document.

You can now simply check a box and that should do it for you.

Check this post by the developer

Thanks for a quick reply. Just checked I am on 22.6.20
Also tried to download again to see if I installed an older version.

But again after installation its still 22.6.20
Can you please share the link of r22.6.9

Just noticed. It works on default theme. But if i use a custom theme its not working

Then change your custom theme with the relevant information that helps it show in the default theme. The easiest way is to compare the code between the two.

I thought so too. But the new theme code is very different from the old one. Couldnt find any field names. Seems like all have been coded in loops to collect info from internal data

That’s true. You can use conditional logic inside the loop for custom_fields. Use field.label property to identify your field. Example:

To target a specific field, say x:

{% for field in custom_fields %}
    {% if field.label == 'x' %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
            </td>
        </tr>
    {% endif %}
{% endfor %}

To exclude a specific field, say y:

{% for field in custom_fields %}
    {% unless field.label == 'y' %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
            </td>
        </tr>
    {% endunless %}
{% endfor %}

thanks.
Will try to see if this can solve my problem.

I tried to make one but is still shown in bottom of page. can u help me to sort out this issue.

I was able to move it on top but not get it under the invoice no where i wanted. Basically a formatting issue.
If you are using a default theme there a checkbox on custom field if you want it on top of the page and it goes there
else you can use this code in custom theme to move it on top

{% for field in custom_fields %}
    {% unless field.label == 'y' %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
            </td>
        </tr>
    {% endunless %}
{% endfor %}

If you are able to place it under invoice no in custom field do let me know how you did it

1 Like

That’s doable. To do that, exclude the invoice number from the fields array using the same logic as above.

Insert the field {{Reference}} followed by your custom field on top of the fields array.