Odoo Help


Hide discounts on order lines on quotations/invoices?

Wolfgang Steuer
on 5/14/13, 7:32 AM 4,625 views

Hi there,

I'm testing openerp since two weeks now and almost everything is fine so that we can use it in our company except for one fact:

I enabled "group_discount_per_so_line" in settings/sale. I created a quotation which has different discounts on certain order lines.

But when I print now the quotation, the user will see their discounts, which (in certain cases) should not be visible to the customer because our company sometimes gives negative discounts for certain customers.

The only way I found out to remove discounts, was to completely remove it from the report file (rml).

Another way I tried was to add another print action to the form with a different rml file which then shows the discounts again. But I does not matter which print button I use, it always takes the original rml report file.

I took a look in the code of the sale module, and it looks like, as soon as I enable per order line discounts, they will be visible in the report, no matter what.

When I use pricelists, I can say "visible discounts", when I uncheck this, this is only valid for pricelist discounts :(.

Is there a way to read this value "visible discounts" in the rml file, so that I can hide the per order line discounts as well?

Did anybody implement a (working) selection to print quotations with different rml files?

Thanks a lot!

My solution:

  1. I enabled developer mode (About OpenERP/Enable developer mode)
  2. I added a boolean field called "x_show_discounts" to sale.order
  3. I changed the rml of sale.order to check this field and if true, display discount otherwise hide it and reduce single prices:

<para style="terp_default_Right_9">[[ not o.x_show_discounts and formatLang(line.price_unit * (1 - line.discount / 100) , digits=get_digits(dp='Product Price')) or formatLang(line.price_unit , digits=get_digits(dp='Product Price'))]]</para>
<para style="terp_default_Centre_9">[[ o.x_show_discounts and formatLang(line.discount, digits=get_digits(dp='Discount')) or '']]</para>

The "line.price_unit * (1 - line.discount / 100)" is needed, otherwise the customer could calculate and see the discount again ...



Brett Lehrer

--Brett Lehrer--

| 5 5 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 5/14/13, 1:40 PM

You might want to try two completely separate reports (not just multiple RML files), and select between them based on what a particular field is set to. A good example of this is in the account_check_printing module:


Check around line 61, the print_check function. So basically create a new module to inherit sale.order and add in a second report to hide the discounts and a boolean field on the partner to hide or unhide discounts in quotations. Then overwrite the report generating action with a button to check that partner and forward to the corresponding report.

That sounds good. I will try it this weekend and keep you updated with my solution! Thx

Wolfgang Steuer
on 5/15/13, 8:08 AM

I solved it in a different way, see my answer

Wolfgang Steuer
on 6/27/13, 12:18 PM

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.


Odoo Training Center

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

Test it now

Question tools

0 follower(s)


Asked: 5/14/13, 7:32 AM
Seen: 4625 times
Last updated: 3/16/15, 8:10 AM