Wednesday, May 29, 2024
3 changes · 17.0
Enhancements to existing features
This update significantly improves the speed of finding contacts by phone number in the VoIP system. Previously, searching for numbers starting with 0 was slow because the system had to scan through millions of records. The fix uses a smarter search approach that leverages existing database indexes, reducing search time from over 12 seconds to just 270 milliseconds—a 46x improvement.
Original PR description
## Description When calling `get_contact_info` searching with a number that starts with `0` will try to do a pattern match with an `=like` + prefix `%`. The problem is that there is only a `btree`…
## Description When calling `get_contact_info` searching with a number that starts with `0` will try to do a pattern match with an `=like` + prefix `%`. The problem is that there is only a `btree` index defined to support the searching that happens via `phone_mobile_search`, but a `btree` index cannot be used with pattern matching `%`/`_` at the *beginning* of the search term. Therefor Postgres will do a `Seq.Scan`, since it's the only criteria there is for this domain. ## Solution To support pattern searching starting with a wildcard, it's required that there is a defined `gin` index with the proper expression (`regexp_replace` support). Since this is the only instance where such searching is needed, adding a whole index for it is overkill. An alternative solution is to do exact matches for all possible country code we have. This is a *sane* operation, as the number of countries is small and fixed. We avoid the `Seq.Scan` by hitting the defined `btree` index. Sadly the `phone_mobile_search` field doesn't implement the `in/not in` operator, so we are forced to use `OR` for each domain leaf, as implementing the `in/not in` ops on the search field is not feasible in a small diff for a stable patch. The where clause from the generated query from the domain will be a disjunction of a bunch of `OR FALSE` or `OR res_partner.id IN (<ids>)`. Thankfully, this is an SQL structure that Postgres can optimize out (removing the redundant `OR FALSE` clauses), reducing the query to a simple `id IN (...)`, which will hit the Pkey index. The only regression is the number of queries executed to resolve the domain of the search field, which +1 query count for each OR leaf of the domain. (would be avoided if the search field implemented the `in` ops). ## Benchmark On a staging database with over 5M `res.partner`, the time taken for the resolution of the searchable field `phone_mobile_search` takes: | | Before | After | |---------|---------|--------| | Timings | 12.43 s | 270 ms | ## Reference task-3942852
This update modifies the 5% VAT tax codes and reporting lines for Ecuador's localization module to comply with May 2024 tax regulations. The changes update tax code references for both goods sales and purchases, and add new standardized report lines for local transactions subject to the 5% VAT rate. This ensures accurate tax reporting and compliance with current Ecuadorian tax requirements.
Original PR description
Update tax codes: - IVA 5% (411, Bienes) -> _IVA 5% (435, Bienes) (code_base: 435, code_applied: 445)_ - IVA 5% (510, Crédito IVA) -> _IVA 5% (550, Crédito IVA) (code_base: 550, code_applied: 560)_ Create Report lines: - _Ventas locales (excluye activos fijos) gravadas tarifa 5%_ - _Adquisiciones y pagos locales (excluye activos fijos) gravados con tarifa 5% (con derecho a crédito tributario)_
This update improves the tax system for Turkish users by adding new accounts, restructuring tax categories and groups, and creating a new tax report. These changes enhance the user experience and make tax management more efficient for businesses operating in Turkey.
Original PR description
[IMP] l10n_tr: improve turkey's tax structure - Adding new accounts. - Adding entirly new taxes - Restructure the tax and tax group - Create new tax report Reason: Enhance the user-experience in turkey Task-3924220 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr