Daily updates from Odoo
Friday, February 2, 2024
3 changes
Resolved issues and error corrections
A bug in Odoo 17.0 was preventing WhatsApp messages from being sent to customers who had previously opted back in. The system was incorrectly blocking all messages from numbers in the blacklist, regardless of their active status. This fix ensures that only customers who have actively opted out (sent 'STOP') are blocked from receiving messages, allowing normal conversations to resume.
Original PR description
When a customer sends a message to Odoo via WhatsApp, their number is saved in the `phone.blacklist` model, but the active state is set to False. If the customer sends 'STOP', it will be set to True,…
When a customer sends a message to Odoo via WhatsApp, their number is saved in the `phone.blacklist` model, but the active state is set to False. If the customer sends 'STOP', it will be set to True, and if the customer sends a new message, it will again be set to False.
Before sending a message from Odoo to a customer via WhatsApp, we check if the number is in the `phone.blacklist` with this line:
if self.env['phone.blacklist'].sudo().search([('number', 'ilike', number)]):
In SaaS 16.4, this line returns the following SQL request:
SELECT "phone_blacklist"."id" FROM "phone_blacklist" WHERE (("phone_blacklist"."active" = true) AND ("phone_blacklist"."number"::text ILIKE '%32491730941%')) ORDER BY "phone_blacklist"."id";
Here, we check if the Active state is True to block the message if necessary.
In 17.0, this same line returns this SQL request:
SELECT "phone_blacklist"."id" FROM "phone_blacklist" WHERE ("phone_blacklist"."number"::text ILIKE '%32491730941%') ORDER BY "phone_blacklist"."id";
This time, the Active state is not checked, so regardless of whether it's False or True, the message is blocked. This makes it impossible to have a conversation with a customer in Odoo 17.0
The solution is to add ('active', '=', True) to the line in 17.0
if we go further we find that it's really because of the active_test = False of this line in thread.py thread = request.env[thread_model].with_context(active_test=False).search([("id", "=", thread_id)]) from this commit
https://github.com/odoo-dev/odoo/commit/8b2605b99348b7707b3db3db46af880c17c7029cThis fix resolves an issue where data inconsistencies between time off allocations and leave requests would incorrectly block employees from taking time off and affect their dashboard calculations. The update refines the validation logic to only flag issues directly caused by the leave request itself, while still warning about other data problems. Additionally, the fix significantly improves dashboard performance, reducing load time from 0.6 seconds to 0.04 seconds.
Original PR description
Before this commit, discrepancies between leaves and allocations for an specific employee and a specific time off type would have prevented the employee from taking any time off for that time off…
Before this commit, discrepancies between leaves and allocations for an specific employee and a specific time off type would have prevented the employee from taking any time off for that time off type. It would also affect their dashboard. __How to reproduce the issue:__ - time off type without negative amount - create 2 allocations: last year and this year - create a leave last year - remove last year allocation from DB - you cannot take leaves this year - dashboard amount is affected by last year's leave __Changes brought with this commit:__ This commit keeps the logic identical for negative time off types. However, for the others, the check ensuring the allocation validity for the leave will now check the discrepancies before and after a time off creation or modification. The error will be thrown if the discrepancies have changed, meaning that the leave had an effect on it. This way, any other issue will not prevent leave creation. Those leaves are still noticeable through the warning though, meaning that they can be noticed and dealt with accordingly. Perf fix: ======= Before  After 
A bug in the Stripe Express Checkout feature was causing incorrect total payment amounts to be calculated. The system was concatenating the order amount and delivery cost as text instead of adding them as numbers, resulting in wrong totals being charged to customers. This fix ensures amounts are properly converted to numbers before calculation.
Original PR description
The total amount is computed by adding the order amount and the delivery amount. The order amount was provided as a string, and the computation didn't convert it to a number before adding it to the delivery amount. As a result, the amounts were concatenated instead of added, yielding an incorrect result. opw-3614909 opw-3664682