Saturday, June 11, 2022
1 change · master
New functionality added to Odoo
This change adds a way for Odoo reports and grouped lists to filter results after totals are calculated, similar to filtering on final subtotals. This helps businesses avoid misleading grouped results, such as customers whose transactions cancel out to zero still appearing in reports.
Original PR description
Description of the issue/feature this PR addresses:
Having Clause in read_group Function
Current behavior before PR:
Let's say we have some records:
id | partner_id | balance
1 | 10 | 1000
2 | 10 | -1000
3 | 11 | 500
4 | 11 | 200
Currently, only 'WHERE' clauses are provided. If we call the read_group(domain=[('balance','!=',0)], fields=['partner_id', 'balance'], groupby=['partner_id']) , then we'll get:
partner_id | balance
10 | 0
11 | 700
Desired behavior after PR is merged:
Sometimes we need the read_group function to filter as the 'HAVING' clause in SQL do and expect something like read_group(domain=[], fields=['partner_id', 'balance'], groupby=['partner_id'], having_clause_domain=[('balance','!=',0)]) so we can get:
partner_id | balance
11 | 700
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr