Skip to content

[FIX] condominium: prevent error when opening form view of motion#1828

Closed
fw-bot wants to merge 1 commit intoodoo:saas-19.1from
odoo-dev:saas-19.1-19.0-sentry-7317501911-error-when-opening-motion-form-view-reka-505837-fw
Closed

[FIX] condominium: prevent error when opening form view of motion#1828
fw-bot wants to merge 1 commit intoodoo:saas-19.1from
odoo-dev:saas-19.1-19.0-sentry-7317501911-error-when-opening-motion-form-view-reka-505837-fw

Conversation

@fw-bot
Copy link

@fw-bot fw-bot commented Mar 10, 2026

When a user opens the form view of a motion, a traceback will appear.

Steps to reproduce the error:

  • Install the condominium module
  • Go to Calendar > Create a new meeting > Set Condominium >
    In the Motions Tab, Set a Voting key and Motion > Save
  • Click on the View button of the motion

Traceback:

ZeroDivisionError: float division by zero

x_in_favor = sum(attendee.x_ratio for attendee in event.attendee_ids if (attendee.x_delegating or attendee.x_attending) and attendee.partner_id.id in voters)
record['x_in_favor'] = x_in_favor / sum([x_ratio.x_ratio for x_ratio in event.x_voting_key_id.x_ratio_ids]) / event.x_attending_ratio
The error occurs because the computation divides by:
sum([x_ratio.x_ratio for x_ratio in event.x_voting_key_id.x_ratio_ids])

This value can become 0 when:

  • There are no x_ratio_ids, or
  • The sum of x_ratio values equals 0

As a result, the division raises a ZeroDivisionError when opening the motion form view.

sentry-7317501911

Forward-Port-Of: #1822

When a user opens the form view of a motion, a traceback will appear.

Steps to reproduce the error:
- Install the "condominium" module
- Go to Calendar > Create a new meeting > Set Condominium >
  In the Motions Tab, Set a Voting key and Motion > Save
- Click on the View button of the motion

Traceback:
"ZeroDivisionError: float division by zero"

https://github.com/odoo/industry/blob/5af6517539f2929b0f1549c05f58babf60fb4450/condominium/data/ir_model_fields.xml#L876-L877
The error occurs because the computation divides by:
"sum([x_ratio.x_ratio for x_ratio in event.x_voting_key_id.x_ratio_ids])"

This value can become 0 when:
- There are no "x_ratio_ids", or
- The sum of "x_ratio values" equals 0

As a result, the division raises a ZeroDivisionError when opening
the motion form view.

sentry-7317501911

X-original-commit: 2b9e5b1
@robodoo
Copy link
Collaborator

robodoo commented Mar 10, 2026

Pull request status dashboard

@fw-bot
Copy link
Author

fw-bot commented Mar 10, 2026

This PR targets saas-19.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

robodoo pushed a commit that referenced this pull request Mar 10, 2026
When a user opens the form view of a motion, a traceback will appear.

Steps to reproduce the error:
- Install the "condominium" module
- Go to Calendar > Create a new meeting > Set Condominium >
  In the Motions Tab, Set a Voting key and Motion > Save
- Click on the View button of the motion

Traceback:
"ZeroDivisionError: float division by zero"

https://github.com/odoo/industry/blob/5af6517539f2929b0f1549c05f58babf60fb4450/condominium/data/ir_model_fields.xml#L876-L877
The error occurs because the computation divides by:
"sum([x_ratio.x_ratio for x_ratio in event.x_voting_key_id.x_ratio_ids])"

This value can become 0 when:
- There are no "x_ratio_ids", or
- The sum of "x_ratio values" equals 0

As a result, the division raises a ZeroDivisionError when opening
the motion form view.

sentry-7317501911

closes #1828

X-original-commit: 2b9e5b1
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
robodoo pushed a commit that referenced this pull request Mar 10, 2026
When a user opens the form view of a motion, a traceback will appear.

Steps to reproduce the error:
- Install the "condominium" module
- Go to Calendar > Create a new meeting > Set Condominium >
  In the Motions Tab, Set a Voting key and Motion > Save
- Click on the View button of the motion

Traceback:
"ZeroDivisionError: float division by zero"

https://github.com/odoo/industry/blob/5af6517539f2929b0f1549c05f58babf60fb4450/condominium/data/ir_model_fields.xml#L876-L877
The error occurs because the computation divides by:
"sum([x_ratio.x_ratio for x_ratio in event.x_voting_key_id.x_ratio_ids])"

This value can become 0 when:
- There are no "x_ratio_ids", or
- The sum of "x_ratio values" equals 0

As a result, the division raises a ZeroDivisionError when opening
the motion form view.

sentry-7317501911

closes #1828

X-original-commit: 2b9e5b1
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
@robodoo robodoo closed this Mar 10, 2026
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