Skip to Content
Menu
This question has been flagged
1 Reply
2574 Views

Hi. Im having a big issue.


Regarding the load_needaction repetitive call from the system i found that the problem comes from _where_calc with domain beeing [('message_unread', '=', True)]. The Query result shows as:
Tables = ['"mail_message" as "sale_order__message_ids"', '"mail_notification" as "sale_order__message_ids__notification_ids"', '"sale_order"']
where_clause = ['("sale_order"."id"="sale_order__message_ids"."res_id" AND "sale_order__message_ids"."id"="sale_order__message_ids__notification_ids"."message_id") AND (("sale_order__message_ids"."model" = %s) AND (("sale_order__message_ids__notification_ids"."partner_id" in (%s)) AND ("sale_order__message_ids__notification_ids"."is_read" IS NULL or "sale_order__message_ids__notification_ids"."is_read" = false )))']

While the sql work and the number of rows involved is low, there were no problem. But lately the number of sale.order grow very big, and this "garbage" sql make my system to freeze for 2 mins every timethe system ask for load_needaction.


I fixed the problem myself with a direct cr.execute in the correct location, but i'd like to know why _where_calc is not properly building the sql, or how to manage to make it work properly.


Thank you.

Avatar
Discard
Author Best Answer

Hello. Some updates.

I have checked the Expression and Query classes. I have yet to understand all the code, but looks like when Expresion return the Query obj no joins are set. On models._search(...) joins are made for orders.


Can someone explain me why Expression is not using Query.addJoin() ????

Thank you 

Avatar
Discard