odoo/industry#1828

Created by fw-bot
Merged at a0ba9c95d7860927f9ade4a95e4bb8537f494fd2

Statuses:

label
odoo-dev:saas-19.1-19.0-sentry-7317501911-error-when-opening-motion-form-view-reka-505837-fw
head
455585d39856beecac47f5bdd2de11aed3f7c743
merged
1 week ago by Industry, Vallaeys Valentin (vava)
odoo/industry
19.0 #1822
saas-19.1 #1828
saas-19.2 #1829
master #1830

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

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

Forward-Port-Of: #1822