Quotation format & fields

OK, I’ll give you really easy tutorial how to achieve this.

First create custom field on your sales invoice (make sure custom field is marked to “show on printed documents”)

Then go to Themes under Settings and create new theme. Actually don’t create new one from scratch, go view Plain theme than copy it to new theme (so we can edit it).

Let’s call it Plain (custom)

and notice how lines 18-21 contain following 4 lines:

{% for field in fields %}
<div style="font-weight: bold">{{ field.label }}</div>
<div style="margin-bottom: 10px">{{ field.text }}</div>
{% endfor %}

These 4 lines are responsible for showing invoice date, invoice number etc. If you want to show content of your custom field below these basic fields, insert following lines after {% endfor %}

<div style="font-weight: bold">Some Custom Field</div>
<div style="margin-bottom: 10px">{{ custom_fields["Some Custom Field"] }}</div>

You will end up with:

{% for field in fields %}
<div style="font-weight: bold">{{ field.label }}</div>
<div style="margin-bottom: 10px">{{ field.text }}</div>
{% endfor %}
<div style="font-weight: bold">Some Custom Field</div>
<div style="margin-bottom: 10px">{{ custom_fields["Some Custom Field"] }}</div>

Save your custom theme. Go to edit your sales invoice and set your custom theme to Plain (custom).

When you view your invoice, your custom field will show below basic fields.

One issue you will notice, your custom field now shows twice. The second time at the bottom of the invoice. To hide it, go back to edit your custom theme and find following lines:

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

After {% for field in custom_fields %} insert this line:

{% if field.label == 'Some Custom Field' %}{% continue %}{% endif %}

So you will have this:

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

This will suppress Some Custom Field in the bottom.

1 Like