OCA / sale-reporting

GNU Affero General Public License v3.0
50 stars 193 forks source link

[FIX] sale_layout_category_hide_detail: Improve interoperability, hide discounted price too #291

Open Sibert-Aerts opened 4 weeks ago

Sibert-Aerts commented 4 weeks ago

Installing this module alongside a custom module of our own we noticed it failed. The cause of this was a few instances of the following:

<attribute
    name="t-if"
    add="not current_section or current_section.show_line_amount"
    separator=" and "
 />

Though these show foresight they also lack parentheses around the epxression, if applied to an element that already has a t-if this forms an illogical expression with erroneous results. e.g. hide_discount and not current_section or current_section.show_line_amount causes an Exception when hide_discount is False and current_section is None, I hope you can see why.

Additionally, while fixing this I noticed there was a unit price displayed in the sale portal layout when a line is discounted, that wasn't being hidden when it should have been, an extra rule was added for that case.