Creating Custom Order Notes

Overview

Default templates are provided for all order notes. If you wish to customize these templates, you can do so by overriding the default templates with your own.

Adding a Custom Template

To add a custom order note template, follow these steps:

  1. In the Admin Panel, navigate to:
    Home › B3_Pdf › Order Note Templates

  2. Add a new order note template to override the default template.

When creating or configuring production sheets in the Admin Panel, the following fields are available:

Field

Description

Field

Description

Template name

Specify one of the following values to override the corresponding default template:

  • order_notes/confirmation_note.html

  • order_notes/delivery_note.html

  • order_notes/invoice.html

Template

Provide a Django HTML template here. The Django templating engine will use this to generate PDF files. An example template is provided below.

Service

Select the Service to which this template applies. Leave empty if the template should be applied to all Services within the organization.

Organization

Select the organization to which this template applies. Leave empty if the template applies only to a Service.

Example Template

Below is an example of an invoice HTML template.

For help configuring templates or to obtain additional default templates, you can reach out to our Customer Support.

{% load i18n static pdf_tags %} {% get_current_language as LANGUAGE_CODE %} <!doctype html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{{ preview_title }}</title> <link rel="stylesheet" href="{% static 'css/order_notes/base.css' %}"> {% if css_additional %} <link rel="stylesheet" href="{% static css_additional %}"> {% endif %} {% include "b3_pdf/extra_header.html" %} </head> <body> <header> <table class="header"> <tr> <td class="header__logo"> <img src="{{ logo_url }}" alt="Default Logo"> </td> </tr> </table> <div class="header__address"> {{ service.name }} | {{ sender_address_line }} </div> <table class="address"> <tr> <td class="address__to"> <div class="element__label">{% trans 'Billing Address' %}</div> <div class="element__value"> {{ billing_address.salutation }} {% if billing_address.company_name %} <br/> {{ billing_address.company_name }} {% endif %} {% if billing_address.line1 %} <br/> {{ billing_address.line1 }} {% endif %} {% if billing_address.line2 %} <br/> {{ billing_address.line2 }} {% endif %} <br/> {{ billing_address.city }}{% if billing_address.state %}, {{ billing_address.state }}{% endif %}, {{ billing_address.zip_code }} <br/> {{ billing_address.country.name }} </div> </td> <td class="address__from"> <div class="element__label">{% trans 'Customer Support' %}</div> <div class="element__value"> {{ service_address.phone_number }} {% if service.email %} <br> {% trans 'Email:' %} {{ service.email }} {% endif %} <br> {% trans 'Processed by:' %} {{ service_user_name }} <br> {{ note_data.issue_date|date:theme_date_format }} </div> </td> </tr> </table> </header> <main> <h1 class="page-title"> {{ note_name }}: {{ note_prefix }}{{ note_id }} </h1> <table class="info"> <tr> <td class="element"> <div class="element__label">{% trans 'Order #' %}</div> <div class="element__value">{{ order_obj.full_number }}</div> </td> <td class="element"> <div class="element__label">{% trans 'Order Date' %}</div> <div class="element__value">{{ order_date|date:theme_date_format }}</div> </td> {% if is_customer_number_shown %} <td class="element"> <div class="element__label">{{ customer_number_label }}</div> <div class="element__value">{{ customer_number|default:"-" }}</div> </td> {% endif %} {% if is_customer_reference_shown %} <td class="element"> <div class="element__label">{{ customer_reference_label }}</div> <div class="element__value">{{ customer_reference|default:"-" }}</div> </td> {% endif %} </tr> </table> <table class="info info--grey"> <tr> <td class="element"> <div class="element__label">{% trans 'Order Confirmation #' %}</div> <div class="element__value">{{ confirmation_note.order_confirmation_number }}</div> </td> <td class="element"> <div class="element__label">{% trans 'Payment method' %}</div> {% if payment_custom_fields %} <div class="element__value">{{ payment_custom_fields }}</div> {% else %} <div class="element__value">{% trans order_obj.payment_method_name %}</div> {% endif %} {% comment %} To access individual payment metadata items: {% if payment_metadata %} {% for key, value in payment_metadata.items %} {{ key }}: {{ value }}<br> {% endfor %} {% endif %} {% endcomment %} </td> <td class="element"> <div class="element__label">{% trans 'Delivery date' %}</div> <div class="element__value">{{ note_data.shipping_date|date:theme_date_format }}</div> </td> <td class="element"> <div class="element__label">{% trans 'Shipping Type' %}</div> <div class="element__value"> {{ order_obj.shipping_method }} </div> </td> </tr> </table> {% if backdrop_text %} <div class="overlay-wrapper"> <div class="overlay-text"> {% trans backdrop_text %} </div> </div> {% endif %} <section id="customer-greeting"> <h4>{% blocktrans %}Dear Sir or Madam, Thank you for your order.{% endblocktrans %}</h4> <p> {% blocktrans %} We hope you were satisfied with the handling of your order so far. If you have any questions or need further information, we are of course happy to help. {% endblocktrans %} </p> </section> <section id="order-lines"> <table class="kt-table"> <thead> <tr> <th class="line-number">#</th> <th class="line-image"></th> <th class="line-part">{% trans 'Part' %}</th> <th class="line-quantity text-right">{% trans 'Qty.' %}</th> <th class="line-price-unit text-right">{% trans 'Unit Price' %}</th> <th class="line-price-discount text-right">{% trans 'Discount' %}</th> <th class="line-price-total text-right">{% trans 'Item Total' %}</th> </tr> </thead> <tbody> {% for line in order_lines %} <tr> <td>{{ forloop.counter }}</td> <td class="line-thumbnail"> <img src="{{ line.thumbnail }}" alt="{{ line.fullName }}" class="line-image" > </td> <td> <b>{{ line.fullName }}</b> <br> {{ line.offer.technology }} <br> {{ line.offer.material }} | {{ line.prices.printPrice|as_currency:line.prices.currency }} {% if line.offer.postProcessings %} <br> {% for option in line.offer.postProcessings %} <br/>{{ option.name }} {% if option.colorTitle %} | color: {{ option.colorTitle }}{% endif %} {% if option.price %} | {{ option.price|as_currency:line.prices.currency }}{% endif %} {% endfor %} <br> {% endif %} <br> {{ line.dimensions.w|floatformat:2 }} * {{ line.dimensions.h|floatformat:2 }} * {{ line.dimensions.d|floatformat:2 }} ({{ line.measureUnit }})| {{ line.weight|floatformat:line.weightDecimals }} {{ line.weightUnit }} <br> </td> <td class="text-right quantity">{{ line.quantity }} / {{ line.quantity }}</td> <td class="text-right unit-price"> {{ line.prices.unitPrice|as_currency:line.prices.currency }} </td> <td class="text-right discount"> {% if line.prices.discount %} {{ line.prices.discount|as_currency:line.prices.currency }} {% else %} --/-- {% endif %} </td> <td class="text-right line-price"> {{ line.prices.linePrice|as_currency:line.prices.currency }} </td> </tr> {% if line.part_requirements.fields.all %} <tr> <td colspan="2"></td> <td> {% for field in line.part_requirements.fields.all %} {% if field.show_on_pdf %} <span class="part_requirements_field"> <span class="label">{{ field.property.name }}:</span> {{ field.get_value_as_str_pretty_printed }} </span> <br> {% endif %} {% endfor %} </td> <td colspan="4"></td> </tr> {% endif %} {% endfor %} <tr> <td colspan="4"></td> <td colspan="3"> <table id="order-totals-summary" class="totals-summary"> <tbody> <tr> <td class="totals sub-total" width="50%"> {% trans 'Subtotal' %}: </td> <td class="totals sub-total" width="50%"> {{ subtotal|as_currency:order_obj.currency }} </td> </tr> <tr> <td > {% trans 'Including' %}: </td> </tr> <tr> <td > * {% trans 'Post-Processings' %}: </td> <td> {{ post_processings_price|as_currency:order_obj.currency }} </td> </tr> <tr> <td > * {% trans 'Printing' %}: </td> <td> {{ printing_price|as_currency:order_obj.currency }} </td> </tr> {% if fee %} <tr class="extra-fee"> <td>{% trans 'Extra Fee' %}:</td> <td> {{ fee|as_currency:order_obj.currency }} </td> </tr> {% for fee_obj in fees %} <tr> <td>* {{fee_obj.fee}}</td> <td>{{fee_obj.amount|as_currency:order_obj.currency}}</td> </tr> {% endfor %} {% endif %} {% if difference_to_minimum > 0 %} <tr class="difference-to-minimum"> <td>{% trans 'Difference to minimum price' %}:</td> <td> {{ difference_to_minimum|as_currency:order_obj.currency }} </td> </tr> {% endif %} {% if voucher_discount > 0 %} <tr class="voucher-discount"> <td>{% trans 'Voucher' %}:</td> <td> {{ voucher_discount|negative|as_currency:order_obj.currency }} </td> </tr> {% endif %} {% if shipping_price > 0 %} <tr class="shipping-price"> <td>{% trans 'Shipping' %}:</td> <td> {{ shipping_price|as_currency:order_obj.currency }} </td> </tr> {% endif %} <tr class="total-without-tax"> <td>{% trans 'Net total' %}:</td> <td> {{ total_prices.excl_tax|as_currency:order_obj.currency }} </td> </tr> <tr class="tax"> <td>{{ tax_rate|floatformat:2 }}% {% trans 'VAT' %}:</td> <td> {{ tax|as_currency:order_obj.currency }} </td> </tr> <tr class="totals grand-total"> <td>{% trans 'Gross Total' %}:</td> <td>{{ total_prices.incl_tax|as_currency:order_obj.currency }}</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </section> {% if note_data.comment %} <section id="comment"> <h3>{% trans 'Comment' %}</h3> <p class="comment">{{ note_data.comment|linebreaksbr }}</p> </section> {% endif %} {% if general_sales_conditions %} <section id="general-sales-conditions"> <h3>{% trans 'General Sales Conditions' %}</h3> <div> {{ general_sales_conditions|linebreaks }} </div> </section> {% endif %} {% if general_shipping_conditions %} <section id="shipping-conditions"> <h3>{% trans 'General Shipping Conditions' %}</h3> <div> {{ general_shipping_conditions|linebreaks }} </div> </section> {% endif %} </main> <footer class="footer"> <p>{{ page_footer }}</p> </footer> </body> </html>

Available Variables

https://3yourmind.atlassian.net/wiki/x/BIAShg