콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
9 답글
13454 화면

in PosTicket xml, the price, subtotal, change or something related to price always have .00 at the end. How can we remove them? I can remove outside ( at the price of product ) but, the receipt don't change. Any ideas for this problem. Thanks in advance

아바타
취소

use round function

작성자

I used, but it's not working. Beside that, i use python code inside t-esc but it print me "NaN".

convert values to INT

작성자

my value in product is Int ( i revert successfully when create new product with price ). But when you go into POS and print receipt, It's still have .00 on the bill.

inherit pos receipt template and change the value.

베스트 답변

Try This :-

<span t-esc="'%.0f'% field_name"/>


아바타
취소
베스트 답변

Hello Try this

10.1223 should  be your_field_name

<t t-esc=" '%.0f' % 10.1223"/> prints 10
<t t-esc=" '%.1f' % 10.1223"/> prints 10.1
<t t-esc=" '%.2f' % 10.1223"/> prints 10.12
아바타
취소
베스트 답변

Hello LaoThai,


Try This :-

<span t-esc="'%.2f'% field_name"/>


Hope it will works for you.

Thanks,

아바타
취소
작성자

Hello Jignesh, I wite a custom addons to do that, so i need to call the function get_display_price in models.js ( inside point_of_sale ). and then, use that function to show the data without decimal in that field. But when i call this function in my customJs file, it cann't call and give me an error: Unexpected token .

베스트 답변

You can change this from odoo core,

for that go to the point_of_sale module and follow below path to fin the pos.xml file.

point_of_sale -> static -> src -> xml -> pos.xml

under above file change the Total field value  <t t-esc = "widget.format_currency (order.get_total_with_tax ())" />  to
<t t-esc = "order.get_total_with_tax ()" />

<tt-name = "PosTicket"> 
<div class = "pos-sale-ticket">

<div class = "pos-center-align"> <tt-esc = "order.formatted_validation_date" /> <t t -esc = "order.name" /> </ div>
<br />
<t t-esc = "widget.pos.company.name" /> <br />
<div class = "receipt-phone">
Phone : <t t-esc = "widget.pos.company.phone || ''" /> <br />
</ div>
<div class = "receipt-user">
User: <t t-esc = "widget .pos.get_cashier (). name "/> <br />
</ div>
<br />
<tt-if = "receipt.header">
<div style = 'text-align: center'>
<t t-esc = "receipt.header" />
</ div>
<br />
</ t>
<table class = 'receipt-orderlines'>
<colgroup>
<col width = '50%' />
<col width = '25% '/>
<col width =' 25% '/>
</ colgroup>
<tr t-foreach = "orderlines" t-as = "orderline">
<td>
<t t-esc = "orderline.get_product (). Display_name" />
<t t- if = "orderline.get_discount ()> 0">
<div class = "pos-disc-font ">
With a <t t-esc =" orderline.get_discount () "/>% discount
</ div>
</ t>
</ td>
<td class = "pos-right-align">
<t t-esc = "orderline.get_quantity_str_with_unit ()" />
</ td>
<td class = "pos right-align ">
<t t-esc =" widget.format_currency (orderline.get_display_price ()) "/>
</ td>
</ tr>
</ table>
<br />
<table class = 'receipt-total' >
<tr>
<td> Subtotal: </ td>
<td class = "pos-right-align">
<t t-esc = "widget.format_currency (order.get_total_without_tax ())" />
</ td>
</ tr>
<t t-foreach = "order.get_tax_details ()" t-as = "taxdetail">
< tr>
<td> <tt-esc = "taxdetail.name" /> </ td>
<td class = "pos-right-align">
<tt-esc = "widget.format_currency (taxdetail.amount)" />
</ td>
</ tr>
</ t>
<tr>
<t t-if = "order.get_total_discount ()> 0 ">
<td> Discount: </ td>
<td class = "pos-right-align">
<t t-esc = "widget.format_currency (order.get_total_discount ())" />
</ td>
</ t>
</ tr>
<tr class = "emph ">
<td> Total: </ td>
<td class =" pos-right-align ">
<! - <t t-esc =" widget.format_currency (order.get_total_with_tax ()) "/> ->
<t t-esc = "order.get_total_with_tax ()" />
</ td>
</ tr>
</ table>
<br />
<table class = 'receipt-paymentlines'>
<t t-foreach = "paymentlines" t-as = "line">
<tr>
<td>
<t t-esc = "line.name" />
</ td>
<td class = "pos-right-align ">
<tt-esc =" widget.format_currency (line.get_amount ()) "/>
</ td>
</ tr>
</ t>
</ table>
<br />
<table class = 'receipt-change '>
<tr> <td> Change: </ td> <td class = "pos-right-align">
<t t-esc = "widget.format_currency (order.get_change ())" />
</ td> </ tr>
</ table>
<tt-if = "receipt.footer">
<br />
<div style = 'text-align: center'>
<t t-esc = "receipt.footer" />
</ div>
< / t>
</ div>
</ t>


then you can find the change on layout. using that logic you can do your works.
아바타
취소
작성자

I know, but I don't want to change the core code, i want to write my custom addons to update this. In JS file, I can't call the function of models.js at point of sale to use this function and make it clear. Any ideas?

관련 게시물 답글 화면 활동
2
1월 22
4106
2
12월 21
8211
0
6월 21
2174
0
2월 21
2833
0
2월 21
4535