[FIX] pms: allow decimal values in agency commission#416
Merged
Conversation
b012d43 to
4f6d975
Compare
jesusVMayor
approved these changes
Jun 5, 2026
Member
Author
|
/ocabot merge minor |
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
@DarioLodeiros your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-416-by-DarioLodeiros-bump-minor. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
The agency `default_commission` field on `res.partner` was declared as Integer, so any commission with a fractional part (e.g. an OTA charging 15.5%) was truncated to its integer part when stored. This propagated to the reservation `commission_percent` (already a Float) and to `commission_amount`, producing an incorrect amount to invoice. Change `default_commission` to Float so fractional commissions are preserved end to end. Existing integer values are kept on update.
4f6d975 to
dfad90e
Compare
Member
Author
|
/ocabot merge minor |
Contributor
|
Hey, thanks for contributing! Proceeding to merge this for you. |
Contributor
|
Congratulations, your PR was merged at 98c41d3. Thanks a lot for contributing to OCA. ❤️ |
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.
Problem
The agency
default_commissionfield onres.partnerwas declared asfields.Integer, so any commission with a fractional part (e.g. an OTA charging 15.5%) was truncated to its integer part when stored.This propagates downstream:
pms.reservation.commission_percent(already aFloat) is computed directly fromagency_id.default_commission, so it inherits the truncated value.pms.reservation.commission_amount = price_total * commission_percent / 100is therefore computed on the wrong percentage, yielding an incorrect amount to invoice.Fix
Declare
default_commissionasfields.Floatso fractional commissions are preserved end to end. The partner form view renders the decimals automatically, and existing integer values are kept on update (the ORM alters the column type in place).Existing tests set
default_commissionto integer values and recompute against the same field, so they remain valid (15 == 15.0).