How to format and round down in QWEB report? - odoo

In Odoo, I set decimal precision to be 4 for a field. Let's call it price.
The field price now has a value with 4 decimal places in the database.
It is displayed in a QWEB report, as expected, with 4 decimal places.
However, I need to display it only the first 2 decimal places with round down method.
Desired examples of price before and after the rounding.
13.4567 ==> 13.45
5.0010 ==> 5.00
97.8391 ==> 97.83
How to achieve such requirement?

You could use:
<span t-esc="'%.2f'%(o.price)"/></span>
or:
<span t-esc="o.price" t-options='{"widget": "float", "precision": 2}'/>
For gane a better control of round precision(up o down) you could write a function to call from qweb that takes o.price and retrieve a desired value.
I hope this can be helpful for you.

Related

QlikView aggr more than one value excluded in list box

I have a list box that is powered by an expression to hide 1 value.
=aggr(only({<[name]-={John}>}[name]),[name])
But i want to add a second name to this. I have tried...
=aggr(only({<[name]-={John, Alan}>}[name]),[name])
And
=aggr(only({<[name]-={John}, {Alan}>}[name]),[name])
Single quotes are required to indicate explicit values:
=aggr(only({<[name]-={'John', 'Alan'}>}[name]),[name])

#MPAndroidChart How to bypass empty data on StackedBar chart

I am a newbie of android developer and it’s 1st post on stackoverflow.
Thanks for your consideration for any inconvenience caused.
I am using MPAndroidChat for StackedBar Chart.
But StackedBar show empty thing on the some position which no entry data. I like to show only 7 data that I provide. Please refer to below screen shoot. It should be show 7 data on 2018/10/12,2018/10/11....2018/10/6, but it show empty chart many times.
Thanks!
Paddy
[detail]
The 7 BarEntry data as below
And I also follow below issue for timestamp label.
https://github.com/PhilJay/MPAndroidChart/issues/789
[issue screen shot]
screen shot
[BarEntry data]
float x=1050,float[] vals={6.0,5.3333335,6.0}
float x=2490,float[] vals={7.3333335,10.0,6.5}
float x=3930,float[] vals={8.5,7.3333335,8.0}
float x=5370,float[] vals={8.333333,7.6666665,7.8333335}
float x=6810,float[] vals={6.6666665,7.6666665,9.5}
float x=8250,float[] vals={8.833333,6.5,8.5}
float x=9690,float[] vals={8.666667,9.0,6.1666665}
So far I try to workaround by change x is increment by 1 day and use referenceTimestamp and IAxisValueFormatter to correct time by value*24*60*60*1000
code
`this.sdf = new SimpleDateFormat("yyyy/MM/dd");`
`return sdf.format(referenceTimestamp + value*24*60*60*1000);`
BTW, I ever try to add setGranularity(1f), setGranularityEnabled(true), it could hidden labels, but still show empty chart.

DevExpress XtraReport - Round Down

Can you tell me how to do rounding like in crystal report? eg: round([field],-2)
How to do Round like the example above. Like we did on Crystal Report. I want to do rounding down on DevExpress XtraReport.
If it value eg. 2514942 I want output: 2514900
Thank you..
you can use CalculatedField for such functionality
add calc field on the same level as your "[field]"
assign to the calc field the expression like "Round([field] / 100, 2) * 100" to reset last two numbers
bind your control to newly created calc field
also here tutorial for the calc fields

Is it possible to use yadcf "ranger_number_slider" in server side processed datatables?

I need some help.
I have a server side processed jquery.datatable. One of the columns is a numeric col with values between 0 and 180.
I would like to filter this column with yadcf ranger_number_slider. I set the yadcf like this:
{
column_number: 14,
filter_type: 'range_number_slider',
filter_container_id: 'external_filter_container_ZZ'
}
But I am faced with some problems:
On the first page of the datatable (paging size is 10, number of entries is roundabout 10.000), the values of this specific column are (accidentally) only from 0 to 30. The ranger_number_slider shown in the div "external_filter_container_ZZ" is as shown below:
Ranger-Number-Slider
As you see in the image, the slider is set from 0 on the left side to 30 on the right side. It seems, that the slider doesn´t get all values from the server side processing for this specific column.
Furthermore: If I try to select some values in the slider, the result in the table is always empty, and the slider disappears!
Is anybody able to give some hints for this behaviour?
Thank you very much in advance.
Best regards
BeSt
Not only that its possible, its available on the showcase page - see here, you must do some reading in the docs / showcase (source on github too) and you will find all the needed docs for that, in short: in addition to your table data that is sent form server to client you must provide yadcf with its data as well - populate the yadcf_data_COL_NUM with the relevant data,
aaData:[["Trident", "Internet Explorer 4.0", "Win 95+", "7/24/2015", "1"],…]
draw:"2"
recordsFiltered:6
recordsTotal:57
yadcf_data_0:[{value: "Trident", label: "Trident Eng'"}, {value: "Tasman", label: "Tasman Eng'"},…]
yadcf_data_1:["Nintendo DS browser", "Netscape Browser 8", "All others", "Lynx", "Mozilla 1.6", "Mozilla 1.5",…]
yadcf_data_2:["N800", "Win 95+ / Mac OS 8.6-9.2", "S60", "KDE 3.5", "Win XP SP2+", "KDE 3.3", "OSX.3", "KDE 3.1",…]
yadcf_data_4:["134", "0"] <- this is for range slider filter tips
From showcase docs
//In case that you want to populate your select / auto_complete
filters with values //you have to add to your current JSON the
following attributes yadcf_data_0 / yadcf_data_1 / etc' //where each
attribute contains a list of strings //For example:
//"yadcf_data_0":["KHTML","Webkit","Trident","Misc","Other
browsers","Tasman","Presto","Gecko"],

Limesurvey 3 Answers Slider Bar

I have a slider bar where I have two answer choices along with the choices "No answer" and "I'm unsure" which were modified in Javascript. I wanted to add another answer choice, to have three in total.
Does anyone know how to do this using Limesurvey or Javascript?
Is this the kind of thing you want to do?
I used element type "Multiple numerical input" and changed settings to:
Use slider layout: Yes
Slider minimum value: 0
Slider maximum value: 100
Slider accuracy: 1
Slider initial value: 0
Allow reset the slider: Yes