Daily updates from Odoo
Tuesday, August 1, 2023
2 changes · master
Resolved issues and error corrections
The Planning module installation now updates employee access tokens in a single database operation instead of several repeated ones. This reduces setup time and network overhead, especially when the application and database run on separate servers.
Original PR description
## Description During the installation of the module `planning`, we have an override of `_init_column` for the `employee_token`. We were using the psycopg's `executemany` which is just a syntactical sugar for a loop over an `execute`. So we trigger 1 query (which incurs a network cost when deployed and the database is not on the same machine), currently we have 20 queries. ## Solution We can use SQL syntax: ```sql UPDATE ... SET ... FROM (VALUES ...) WHERE ... ``` which does 1 update for all rows in one go. ## Implementation details We could implement this query directly with a simple execute, but it requires a lot of manual construction with the help of `sql.Composed`, because of necessity to insert manually `sql.Literal` used for the tuples of the `VALUES`. Psycopg2 exposes a function called `execute_values` which is just for this case and makes to code way more legible. --- task-3430406
This update corrects how the system identifies records after an internal data model change. It helps prevent errors in manufacturing work order displays by using the supported record identifier.
Original PR description
Since the relational model was rewritten (PR 114024), the record id is no longer present in data by default. The correct way to access the id of a record is to do record.resId.