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 | etc.
How can we format values on Qweb reports to only drop the trailing 0's after the decimal poing in Qweb v8 reports? Such that 1.0000 would display as 1, 1.5000 would display as 1.5, and 1.5250 would display as 1.525?
Can it be a modification to formatLang(<<your value>>,digits=0)
I want my quantities in Quotes/Sales Orders/Invoice reports to appear like this https://www.purekarting.com/odoo/lightspeedinvoice.pdf instead of how they are currently like this https://www.purekarting.com/odoo/sale.report_saleorder.pdf
Don't believe there is code to do that. You will probably need to write some code to handle the special formatting you require.
How about trying this piece of coding based on the text of your question/answer:
<t t-if="mod_qty == l.product_uom_qty">
<t t-esc="mod_qty" />
<t t-if="mod_qty != l.product_uom_qty">
<t t-esc="(l.product_uom_qty * 1)" />
Or this generic code that will print your list of numbers.
<t t-foreach="[3.000, 3.050, 3.005, 3.0005]" t-as="my_qty">
<t t-if="mod_qty == my_qty">
<t t-if="mod_qty != my_qty">
<p><t t-esc="(my_qty * 1)"/></p>
I've gotten closer.
By using <t t-esc="(l.product_uom_qty * 1)" />, it converts the qty from a string to a number. Trailing zeros past the first decimal precision are dropped in numbers.
So, seeing as how I have decimal precision set to 3 on product_uom_qty, values will be reported as:
3.000 prints as 3.0
3.050 prints as 3.05
3.005 prints as 3.005
3.0005 is rounded up by Odoo to 3.001, and then prints as 3.001
Close but not perfect. I'd like to drop that trailing .0 from the whole number quantities still.
what you could do is :
import openerp.addons.decimal_precision as dp
and also for example this will allow your field to acces the decimal accuary of account so if you set account to have 8 decimal places your field will have 8 decimal places:
About This Community
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/16/15, 12:33 PM|
|Seen: 6261 times|
|Last updated: 10/5/15, 4:04 PM|