# How to print rounding adjustment value on point of sale receipt?

By
JC
on 1/22/15, 5:53 AM 2,303 views

Is there a way to print rounding adjustment on receipt?

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.

ePillars Systems LLC, Shawn Varghese
on 1/25/15, 12:01 AM

Shawn, I want to show the actual total value and total rounded value on pos receipt.

JC
on 1/25/15, 9:11 PM

#### Shawn Varghese

--Shawn Varghese--
787
| 5 3 7
Dubai, United Arab Emirates
--Shawn Varghese--

Shawn Varghese
On 1/26/15, 2:12 AM

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.

JC
on 1/26/15, 9:23 AM

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

### Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

1 follower(s)

### Stats

 Asked: 1/22/15, 5:53 AM Seen: 2303 times Last updated: 3/16/15, 8:10 AM