Repository navigation
fix(aggregate_records): accept a bare measure in order on Odoo 19 - #73
Open
bitclicklabs wants to merge 2 commits into
Open
bitclicklabs wants to merge 2 commits into
bitclicklabs wants to merge 2 commits into
Conversation
Odoo 19 formatted_read_group only accepts order terms that are a groupby field,
__count or an aggregate spec. Clients naturally write the measure field alone
("amount_untaxed desc"), which Odoo rejects with "Order term ... is not a valid
aggregate nor valid groupby". A bare field that is one of the requested
measures is now sent as "field:agg"; other terms are kept, and legacy
read_group keeps the order unchanged.
This was referenced Oct 22, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Odoo 19,
aggregate_recordswith anorderon a summed field (for exampleorder="amount_untaxed desc"withmeasures=["amount_untaxed:sum"]) fails withOrder term 'amount_untaxed desc' is not a valid aggregate:formatted_read_groupwants measures in
orderasfield:agg. A bare measure inorderis now rewrittento
field:agg(normalize_group_order); group-by fields and explicitfield:aggterms are kept as written. The legacy
read_grouppath (orderby) is unchanged.Agents write the bare form naturally (it is what
read_groupaccepted), so thisshowed up in real use as a failed call followed by a wrong figure.
Coverage
Verification
Live against Odoo 19: 1.3.2 fails on
order="amount_untaxed desc"; this branchreturns the groups sorted by the sum.
The full suite on Windows has two failures unrelated to this change (a symlink
test and a task_queue timing test); they fail on
maintoo.Checklist
README.md/docs/when behavior changes (no documented behavior changes)CHANGELOG.mdunder## UnreleasedNotes for reviewers
Only terms whose name matches a requested measure are rewritten; an
orderon ameasure that was not requested is left as is, so Odoo still reports it.