Is there a way to print rounding adjustment on receipt?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
In the pos.xml file at the path: /point_of_sale/static/src/xml,
there is the PosTicket template which creates the receipt.
The total is displayed in this code:
<t t-esc="widget.format_currency(order.getTotalTaxIncluded())"/>
The format_currency() function actual takes 2 arguments - amount and precision. So if you call the function as
<t t-esc="widget.format_currency(order.getTotalTaxIncluded(),1)"/>
it should have rounded to 1 decimal place. However, it seems if you have specified a decimal precision for your currency (as is probably the case), it will take only that. But the above line did output a whole number, without any decimal places.
I tried using the “round” function, but that also did not work for me.
I suggest creating a separate function, in widgets_base.js similar to the format_currency() function:
format_currency_round: function(amount,precision){
var currency = (this.pos && this.pos.currency) ? this.pos.currency : {symbol:'$', position: 'after', rounding: 0.01, decimals: 2};
var decimals = precision;
if (typeof amount === 'number') {
amount = round_di(amount,decimals).toFixed(decimals);
}
if (currency.position === 'after') {
return amount + ' ' + (currency.symbol || '');
}
else {
return (currency.symbol || '') + ' ' + amount;
}
},
and call it from pos.xml as:
<tr class="emph">
<td>Rounded Total:</td>
<td class="pos-right-align">
<span t-esc="widget.format_currency_round(order.getTotalTaxIncluded(),1)"></span>
</td>
</tr>
This should give you the Total rounded to one decimal place.
Hope this helps.
Thanks Shawn, voted for you.
Not sure if I understood your question, but do you mean that you want to show the actual value and also the rounded value? For rounding, you can try using t-esc="round(total,2)" - which will round to two decimal places.
Shawn, I want to show the actual total value and total rounded value on pos receipt.