Unable to print INVOICE NUMBER on the Sales Invoice generated using POS

Below is the HTML code of the print format.

.print-format table, .print-format tr, .print-format td, .print-format div, .print-format p { font-family: Monospace; line-height: 200%; vertical-align: middle; } @media screen { .print-format { width: 4in; padding: 0.25in; min-height: 6in; } }

{{ company }}
Jahra Mall - Shop#G9
Phone No. 00000000

{{ __("Customer") }}: {{ customer }}

{{ __("Date") }}: {{ dateutil.global_date_format(posting_date) }}

Invoice : #{{ doc.name }}

{% for item in items %} {% endfor %}
{{ __("Item") }} {{ __("Qty") }} {{ __("Amount") }}
{{ item.item_name }} {{ format_number(item.qty, null,precision("difference")) }}
@ {{ format_currency(item.rate, currency) }}
{{ format_currency(item.amount, currency) }}
{% for row in taxes %} {% if not row.included_in_print_rate %} {% endif %} {% endfor %} {% if discount_amount %} {% endif %}
{{ __("Net Total") }} {{ format_currency(total, currency) }}
{{ row.description }} {{ format_currency(row.tax_amount, currency) }}
{{ __("Discount") }} {{ format_currency(discount_amount, currency) }}
{{ __("Grand Total") }} {{ format_currency(grand_total, currency) }}
{{ __("Paid Amount") }} {{ format_currency(paid_amount, currency) }}

{{ terms }}

{{ __("Thank you, please visit again.") }}


POS doesn’t create the Sales Invoice right away, First it will be stored in the Local Storage then after sync all Sales Invoices against the draft Invoices from the POS will be created.

So {{ doc.name }} will not work unless the invoice is synced.


So what is the way to print a reference number on the invoice?

In this thread we are talking about proposals to improve pos behavior, especially for billing cases precisely: POS should not make sales invoice when (Stock Qty: 0)


The suggested thread is completely out of context. It talks about stock handling while making sales transactions. And I’m talking about printing a reference number on the sales invoice.

If you read the whole thread, not only the title, you will see that the conversation led to the billing problem, because in certain countries (at least the Europeans) you can not skip the output of shares or generation of invoices at the time of sale . Since tickets are now simplified invoices. So the offline mode that has the pos does not make sense if you want to respect the legislation in these countries in physical stores.

The colleague ahmadRagheb is doing a patch to be able to pull forward but it would be very interesting to rethink how the POS manages the stock and generating invoices so that it is as compatible as possible with all the cases from all countries.

The issue here is that erpnext generates the invoice number when the stock is reconciled by sync offline POS, that is why the two threads are related, and the problem is crossed. You can not print invoice numbers without synchronizing because the number does not exist yet, and you should be able to configure the POS to bill and generate the number at the time of sale and download stock if we indicate this.