We tried editing the ‘Items (Table)’ at the Print format and we set UOM to be be after the Quantity like shown below. However, it is not reflected at the Print :
Kindly advice on how to set the UOM to be after the Quantity in Print.
Thank you.
We did see that it was not possible in standard format and did our own rearranging of the fields and saved it as a New Custom Print Format.
However, as you have mentioned, this rearranging within the items table was not possible via the Items (table) from the Print Format. In which case, we are curious to understand what is the following Items table edit box (shown below) at the Print Format for, if rearranging cannot be done by dragging to set order.
@asneha1 a small trick is instead of building te whole document you can just create that only line you need, but in your case its a table so you need to build it all from 0
to help you get started you can use the following which will get most of what you want, just you do the styling:
I would love this feature too. It is just proper English for customers to read “20 kg” instead of “kg 20” for example.
So does it mean that I can align the count to the left and align UOM to right?
Realised that Packing Slip’s item table print format has been designed in such a way that the UOM and Quantity could be interchanged - for UOM to be displayed after the Quantity. So interchanging of UOM and Quantity is possible in Packing Slip:
However, when it comes to Purchase Order, the above flexibility is not offered. We tried interchanging the UOM and Quantity but the print format did not seem to change.
Kindly advise if Purchase Order’s item table print format could be made more flexible in the Packing Slip way or is it for Purchase Order, the print format is restricted to not do the swap. Wondering if the swap of UOM and Quantity can be done in Purchase Order like in Packing Slip above, without writing our own print format from scratch in HTML?
To change format from “uom quantity” (e.g. “kg 1”) to “quantity uom” (e.g. “1 kg”) you can change the file:
/frappe-bench/apps/erpnext/erpnext/templates/print_formats/includes/item_table_qty.html
Example:
{{ doc.get_formatted(“qty”, doc) }}
{% if (doc.uom and not doc.is_print_hide(“uom”)) %} {{ _(doc.uom) }}
{% elif (doc.stock_uom and not doc.is_print_hide(“stock_uom”)) %} {{ _(doc.stock_uom) }}
{%- endif %}
For currency, to change format “symbol amount” (e.g. “$ 5”) into “amount iso-code” (e.g. “5 USD”) you have to change two files:
In data.py, you have to modify fmt_money. I simply replaced this (just before “return”):
amount = symbol + " " + amount
with this:
amount = amount + " " + currency
In number_format.js you have to modify format_currency to return this:
format_number(v, format, decimals) + " " + currency;
After making changes you have to run command in terminal:
bench build
It would be good to have it in the core, as built-in customization option, but I don’t know how to contribute, yet.
I added pull request to ERPNext and it was accepted, so in future versions of v13 you will be able to choose option to print UOM after quantity in Print Settings. So you won’t have to make changes as in my previous post every time you update your ERPNext.
Find and locate your “item_table_qty.html” file in your server.
Once you find it, type on your server console: “sudo nano /frappe-bench/apps/erpnext/erpnext/templates/print_formats/includes/item_table_qty.html” or “sudo nano” and copy paste your item_table_qty.html file path
Once you can edit the file and replace ALL of the content by using this code:
{% if (doc.uom and not doc.is_print_hide("uom")) %}
<medium class="pull-right">{{ _(doc.uom) }}</medium>
{% elif (doc.stock_uom and not doc.is_print_hide("stock_uom")) %}
<medium class="pull-right">{{ _(doc.stock_uom) }}</medium>
{%- endif %}
{{ doc.get_formatted("qty", doc) }}