Wednesday, January 25, 2023
1 change · master
Features or functions removed from Odoo
Odoo removed outdated internal method-patching helpers and updated tests to use a safer replacement. This reduces the risk of lingering test changes after failures and simplifies core model behavior without changing normal business workflows.
Original PR description
There is only one legitimate usage of `_patch_method` (base_automation) and none of `_revert_method`. The other uses are in tests and they are all wrong: if the test crashes between the `_patch_method` and the `_revert_method`, the method will not be reverted. For the only proper usage of `_patch_method`, move the code to this place. Correct tests using `_patch_method`/`_revert_method` by calling the `patch` method of `BaseCase`. Also, remove the `api.returns` from the `create` method of `BaseModel` as it is useless and confusing. In fact, we never use it because we have a special treatment at the RPC level for the `create` method (see `_call_kw_model_create`).