odoo/industry#1822

Created by Bugfix, Renilkumar Kajavadra (reka)
Merged at 2b9e5b1afb5a45a31e9dab860e09a38a94f6fd66

Statuses:

label
odoo-dev:19.0-sentry-7317501911-error-when-opening-motion-form-view-reka
head
8b90fa2e250b14d99f6cafbee2fa8945d6bf51f4
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