Skip to Content
Menu
This question has been flagged
3 Replies
5212 Views

How to operate with fields in reports? I would like to add own column with unit price after discount. 

This is the way, how it doesnt work, but I am sure you know what i am trying to do here:

                        <td class="text-right">
                            <span t-field="l.price_unit*(1-l.discount)"/>
                        </td>

Thanks for any help

Avatar
Discard
Author Best Answer

It works, thank you!

Just note for others: value of discount is not stored in %, so it should be like this  

<span t-esc="l.price_unit*(1-l.discount/100)"/>

Avatar
Discard
Best Answer

You use: t-esc

<span t-esc="l.price_unit*(1-l.discount)"/>

Avatar
Discard
Best Answer

Thank you !! it worked wonderfully.

For those who are novices with odoo like me here's a step by step on how to add it. Using odoo 11.0

1) go to settings and activate developer mode > then reports > reports https://i.imgur.com/uJactI5.jpg

2) after that on the search bar type "sale.order" and then click on the model "sale.report_saleorder"
3)click on qweb view, it has the icon " </> "

4) Click on "report_saleorder_document" and then modify.
5) search for this and add this line,you can name it anything https://i.imgur.com/SpsBgrc.jpg

6) now go here and add this line and click save https://i.imgur.com/tufytGY.jpg

now export your PDF reports and they'll include the unit price after discount.


Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
118
1
Apr 24
967
7
Sep 24
22452
1
Mar 24
277
0
Feb 24
415