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.
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!
- I enabled developer mode (About OpenERP/Enable developer mode)
- I added a boolean field called "x_show_discounts" to sale.order
- 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 ...
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.
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: 5/14/13, 7:32 AM|
|Seen: 4110 times|
|Last updated: 3/16/15, 8:10 AM|