Skip to content

[FIX] pms: allow decimal values in agency commission#416

Merged
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:fix-agency-commission-decimals
Jun 8, 2026
Merged

[FIX] pms: allow decimal values in agency commission#416
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:fix-agency-commission-decimals

Conversation

@DarioLodeiros

Copy link
Copy Markdown
Member

Problem

The agency default_commission field on res.partner was declared as fields.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 a Float) is computed directly from agency_id.default_commission, so it inherits the truncated value.
  • pms.reservation.commission_amount = price_total * commission_percent / 100 is therefore computed on the wrong percentage, yielding an incorrect amount to invoice.

Fix

Declare default_commission as fields.Float so 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_commission to integer values and recompute against the same field, so they remain valid (15 == 15.0).

@DarioLodeiros DarioLodeiros force-pushed the fix-agency-commission-decimals branch from b012d43 to 4f6d975 Compare June 5, 2026 10:13
@DarioLodeiros

Copy link
Copy Markdown
Member Author

/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-416-by-DarioLodeiros-bump-minor, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
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.
@DarioLodeiros DarioLodeiros force-pushed the fix-agency-commission-decimals branch from 4f6d975 to dfad90e Compare June 8, 2026 07:45
@DarioLodeiros

Copy link
Copy Markdown
Member Author

/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-416-by-DarioLodeiros-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit c31255f into OCA:16.0 Jun 8, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 98c41d3. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants