Sunday, March 16, 2025
3 changes · master
Enhancements to existing features
This update improves an internal tool used to remove duplicate items, making it faster while keeping the same results. It should slightly improve performance in areas that rely on this shared utility without changing user-facing behavior.
Original PR description
Use `dict` instead of `set` in `unique` for performance. - Memory: The load factor for scaling up is 2/3 for `dict` and 3/5 for `set`, meaning `dict` does not always consume more memory than `set`. Also in our use cases, `unique` is never early stopped, so pre-generating the `dict` is not an issue. - Performance: `dict.fromkeys` assigns values in C, making it significantly faster than using `set.add` in Python. Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Miscellaneous changes
In order to determine if the vat provided is for an autonomo (freelancer) or a juridical person (company), we checked 8 digits and a letter for the freelancer, but NIEs that start with X/Y/Z are also freelancers, so we added that option in the regex. opw-4616635 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-
Original PR description
In order to determine if the vat provided is for an autonomo (freelancer) or a juridical person (company), we checked 8 digits and a letter for the freelancer, but NIEs that start with X/Y/Z are also freelancers, so we added that option in the regex. opw-4616635 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#201620
Initial PR: https://github.com/odoo/odoo/pull/194141 It seems the fix above was not enough as it was assumed that connection (or backend in pg terms) were NOT being reused when initiated through `sql_db.connect`. For proper cleanup we need to reach [this part of the code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L1260-L1298) which can be done in 3 ways: - calling UNLISTEN * and committing - closing the connection - aborting the transaction
Original PR description
Initial PR: https://github.com/odoo/odoo/pull/194141 It seems the fix above was not enough as it was assumed that connection (or backend in pg terms) were NOT being reused when initiated through `sql_db.connect`. For proper cleanup we need to reach [this part of the code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L1260-L1298) which can be done in 3 ways: - calling UNLISTEN * and committing - closing the connection - aborting the transaction (before committing the listen) `UNLISTEN *` is a good candidate for this, but closing the connection seems to be the safer option. Forward-Port-Of: odoo/odoo#201967 Forward-Port-Of: odoo/odoo#201401