Daily updates from Odoo
Saturday, April 12, 2025
1 change · 18.0
Enhancements to existing features
Opening the sharing settings on Knowledge articles is now much faster, especially for articles with many shared members or inherited permissions. This reduces long waits from minutes to milliseconds in large databases, improving responsiveness for users managing article access.
Original PR description
Description ----------- When clicking the sharing button on a knowledge article, the system retrieves all members linked to the article. This includes members directly tied to the article or…
Description ----------- When clicking the sharing button on a knowledge article, the system retrieves all members linked to the article. This includes members directly tied to the article or inherited through parent articles ( stopping at the first desynchronized article). In databases where articles have numerous associated members, the `_get_article_member_permissions` method suffers from severe performance issues. It retrieves *all* articles and their associated members, collects all parent articles in the hierarchy, and only then applies grouping and filtering based on the `id` of `self`. This process includes a `LEFT OUTER JOIN` on related tables to fetch specific `fields` passed as arguments, resulting in an O(n^2) complexity on large tables such as `res.partner` and `knowledge.article.member` (the latter being a Many2many relationship that typically contains a high volume of rows). This patch improves performance by shifting the grouping and filtering logic to the start of the process, effectively injecting all preconditions at the base of the recursion. This reduces the hierarchy of articles and memberships to explore. Additionally, the computation of inherited permissions—sourced from the "closest" ancestor article—is now handled at the SQL level instead of Python. This eliminates unnecessary rows in the process, avoiding unnecessary work in the business logic afterward. Benchmark --------- On a client's database with around 600 articles, 5k partners and 15k knowledge.article.member in total, for a specific article which has a total of 1.7k members (direct and inherited): | Request | Before | After | Speed-up | |--------------------------------|---------|-------|-----------| | `_get_article_permission_data` | 4.7+min | 150ms | **1880x** | Reference --------- opw-4603551