Friday, December 24, 2021
2 changes · master
Code cleanup and technical improvements
This change reorganizes part of the product pricelist logic to make pricing rule checks easier to customize in future developments. It does not introduce a visible change for users, but it helps maintain and extend pricing behavior more safely.
Original PR description
Extract in a method the check of pricelist rules with a given product for easier inherit. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update simplifies and modernizes internal record handling in Odoo's core framework while removing old unused code and deprecated hooks. It should make future maintenance easier and slightly improve performance in some form update scenarios, with minimal direct impact for everyday users.
Original PR description
[REF] base: replace `_browse` by `__init__` The creation of recordset object was done by `_browse` instead of a normal python class with the `__init__`. We remove the old usage of `__init__`, we can…
[REF] base: replace `_browse` by `__init__` The creation of recordset object was done by `_browse` instead of a normal python class with the `__init__`. We remove the old usage of `__init__`, we can now reuse it with a normal usage. After this commit, we can create recordset by the Class without call a classmethod: `self.env['model_name'](env, ids, prefetch_ids)` [REM] base: depreciate _execute_sql It wasn't unused then depreciate to be removed in the next version. [REM] base: remove deadcode from models.py - Remove unused imports `AsIs` and `Collector` - Remove _schema variable (unused) - Remove same_name function (unused) - Remove attribute `_needaction` which is useless - Remove backward compatibility `__new__` and `__init__` which isn't used anymore. - Remove backward compatibility `__export_rows` [FIX] base: two small optimisation - The `update` method of BaseModel wasn't batch for no reason. This method is used in `_onchange_eval` and in few onchange in Odoo. - In `_modified_triggers` avoid a useless record union. [REM] base: depreciated refresh method The `refresh` method of models.py is a duplicate of `invalidate_cache` and deprecated since 8.0 but without any warning. Add this warning to be able to completely remove it in the next version. [REM] base: remove useless view_init view_init is a useless hook call from default_get. We can get the same result by overriding default_get directly.