Commit Graph
5181 Commits
Author SHA1 Message Date
Cédric Krier 6ade5351fb Remove own session access rules
They are useless because session models CRWD methods are not available for
RPC.
2023-09-21 14:07:51 +02:00
Cédric Krier 1b44371641 Remove unnecessary clear of caches when groups are modified
It is the link between group and user that matters for the caches.
2023-09-22 13:42:59 +02:00
Cédric Krier e3c2c10460 Remove unused name parameter from User.get_groups 2023-09-21 14:05:03 +02:00
Cédric Krier 76c442aa20 Use user groups instead of user id in key of access cache
This increases the cache hint as it should be less group combinations than
users.
2023-09-22 11:04:29 +02:00
Cédric Krier 498bb5ff54 Return an ordered tuple for groups of current user
So the tuple can be easily compared and used as key.
2023-09-20 10:15:28 +02:00
Cédric Krier 0ff2fb5651 Add user to get keyword cache
Since d41d48d68cdf model access is checked for window actions. So the returned
keywords depend on the user access rights.

Closes #12580
2023-09-20 09:59:02 +02:00
Cédric Krier e65b98524e Do not store in transaction cache instances of Reference fields
If the target of the Reference field is deleted, the transaction cache is not
cleared because there is no "ON DELETE" support for Reference field. Instead
the ids are checked in the Reference.get method.

Closes #12599
2023-09-28 17:44:29 +02:00
Nicolas Évrard d1d2437daf Use multiple jobs to dump and restore a test database 2023-09-16 12:36:43 +02:00
Nicolas Évrard c32c645483 Support database cache as template for tests on PostgreSQL 2023-10-02 11:16:27 +02:00
Cédric Krier 455d8c362b Do not copy binary field with file_id only if copied data is not changed 2023-07-07 08:44:29 +02:00
Cédric Krier 749292078d Do not uniquely sort list in Dict field without schema
When there is no schema, the list values are not for a MultiSelection entry.

Closes #12417
2023-07-19 22:02:49 +02:00
Cédric Krier a34a07f262 Store a copy of reference selection
Same as #810 but for reference fields
2023-06-21 10:59:55 +02:00
Cédric Krier ea98511139 Add route test case 2023-09-12 18:52:14 +02:00
Cédric Krier 265af5b6b2 Use fallback value for charset, url_charset and encoding_errors
Werkzeug 3.0 removes those attributes.

Closes #12604
2023-09-30 19:55:24 +02:00
Cédric Krier f7dbe9ec90 Keep trying to rename sequence when table is renamed
For table renamed before baa87cf1a343, we must keep renaming existing sequence
because the migration to identity expect that the sequences include the table
name.

Closes #12245
2023-09-17 19:39:19 +02:00
Cédric Krier 208ac87281 Add support for scanning code 2023-07-04 17:50:50 +02:00
Cédric Krier d47163be93 Add unittest for MatchMixin 2023-08-18 17:06:44 +02:00
Cédric Krier b7432a677d Convert pattern values into boolean when matching boolean field
Closes #12504
2023-08-18 17:06:26 +02:00
Cédric Krier c583528ca8 Do not set rec_name for unsaved record
Since 0db956eb2505 _changed_value is used for on_change_with calls, so it can
have to deal with unsaved Many2One value if it is the parent of a One2Many.
2023-09-11 22:02:27 +02:00
Cédric Krier 8885e86581 Return an entry for each value in names of Function field getter
0db956eb2505 removes this behavior if the getter return an empty defaultdict.
2023-09-11 21:58:22 +02:00
Cédric Krier e1123853ab Do not skip many2many in _changed_values
Like the one2many they should always be processed as they can have been
updated.

Closes #12474
2023-08-16 11:37:12 +02:00
Cédric Krier bc5a28a50c Use _changed_values to return result of on_change_with
This allows to support add/update/remove/delete for xxx2many fields and
rec_name for xxx2one and reference fields.

Closes #12473
2023-08-16 16:11:51 +02:00
Cédric Krier 9aa4a8583b Add decorator on RPC 2023-08-16 10:39:16 +02:00
Cédric Krier fe66322ab1 Use on_change_result for on_change call
The ModelView.on_change method returns directly the changed values instead of
a list with the changed values.
2023-08-16 09:37:26 +02:00
Cédric Krier bce30f97f9 Update _changed_values docstring about Many2Many
Since 41f7d6828fcd Many2Many are managed the same way as One2Many.
2023-08-16 09:20:09 +02:00
Cédric Krier 1f3dcc86c7 Do not fail to copy empty list of ModelStorage
Closes #12541
2023-09-04 16:41:33 +02:00
Nicolas Évrard 42cdc26e23 Preserve order of inserted column names on multiple insertion
The order of column names must be the same as the list of values to recompose
a correct dictionary of values when raising error message.

Closes #12552
2023-09-10 11:23:19 +02:00
Cédric Krier edd198c949 Extend translation index to be fully used when searching on translated field 2023-08-29 11:03:19 +02:00
Cédric Krier 423e32a989 Backed out changeset 10e16de6a494
Applying the domain on the LEFT JOIN create wrong result because the fallback
value (from COALESCE) is then used even if a valid translation exists.

Closes #11781
2023-08-29 10:51:04 +02:00
Cédric Krier 6a06579e13 Use Sphinx book theme for documentation 2023-09-01 09:44:09 +02:00
Cédric Krier 1e1ee72f65 Use VARCHAR with size in SQL type for SQLite
Without the size the TableHandler creates a schema without size. When the
schema is updated, it raises a warning because it can not resize from no size.
Also even if SQLite does not enforce the size of the schema, at least we have
a correct schema.

Closes #12471
2023-08-14 19:36:28 +02:00
Cédric Krier 51b032442d Clean self references before deleting records
When deleting a full branch of a tree, if the number of records deleted is
higher than IN_MAX, the foreign key constraint may prevent the deletion
because the group of records deleted may still be referencing a record in the
next group to delete.
To prevent this failure, we must first clean the values of the column with
foreign key referencing the same table. We use the table id as value instead
of NULL in case the column is not nullable.
2023-08-10 16:42:36 +02:00
Cédric Krier d1779f0430 Reuse get_related_records to search restricted foreign keys 2023-08-10 15:07:37 +02:00
Cédric Krier dfa79b36b6 Simplify foreign key search in ModelSQL delete 2023-08-10 15:05:23 +02:00
Nicolas Évrard fbc05e3d22 Use source of translation in the unique_key of Translation objects
Closes #12467
2023-08-11 18:40:32 +02:00
Cédric Krier 804476f318 Remove translations with empty source
It is useless to keep fuzzy translation with empty source.

Closes #12477
2023-08-16 18:24:32 +02:00
Cédric Krier e862ca836a Run doc tests with different globals
Closes #12441
2023-07-29 15:11:05 +02:00
Sergi Almacellas Abellana 3ad60ab0dd Create user applications as validated from user preferences
Closes #12376
2023-08-27 11:46:00 +02:00
Cédric Krier e2676bcd85 Discard disconnected connection from the pool
When a connection in the pool is disconnected, it stays in the pool and it may
still be served.
Using such connection raise an OperationalError and so the request is retried
but before that the connection is put back to the pool. So we may get it back
again.
It is not possible to distinct between an OperationalError due to a
disconnection or due to a isolation error for example.
So with the current design of Transaction API, an OperationalError always put
back the connection to the pool.
This main that we can only ensure that the connections served are still
connected by executing a simple query. And close connections that are failing.

Closes #12452
2023-08-04 15:59:35 +02:00
Cédric Krier 2d8cc458fd Convert element joined domains into domain when searching for OR-ed domain
The content of joined domains can be a single clause, so it must be converted
into a domain before calling search_domain.

Closes #12460
2023-08-10 13:55:00 +02:00
Cédric Krier d706ab7ffa Support GIN index with btree_gin PostgreSQL extension
Closes #12480
2023-08-16 22:03:59 +02:00
Cédric Krier f58582b636 Include Similarity in the indexed expression of BTREE
The Similarity expression increase the score and are supported in BTREE.

Closes #12479
2023-08-16 21:53:32 +02:00
Cédric Krier 318950e03b Filter expressions for BTREE and GIN indexes
IndexMixin is calling the method _get_indexed_expressions instead of
_get_expressions.

Closes #12478
2023-08-16 21:50:05 +02:00
Cédric Krier de1386328b Update style for flake8 6.1.0
Closes #12475
2023-08-16 11:49:30 +02:00
Nicolas Évrard 82ae036d3a Add a canonicalize function for domains 2023-08-14 22:32:14 +02:00
Cédric Krier bf9735dd5a Remove useless state variable when initialize database 2023-08-14 22:02:09 +02:00
Nicolas Évrard f8de1d23c6 Replace NEXTVAL call by IDENTITY for database initialisation 2023-08-14 21:26:59 +02:00
Nicolas Évrard fe44d98d76 Move sleep loop introduced in a32b84d96649 to prevent deadlock to tests
In this changeset we fix an issue with testing.

When using the listener for cache invalidation it results into the database
lock used by the pool that is acquired twice. Once when calling Pool.init ;
once when the transaction is started which calls Cache.sync which in turn calls
Pool.refresh and finaly Pool.stop. It tries to acquire again the re-entrant
lock (but it cannot because it's another thread).

Closes #12457
2023-08-08 15:33:33 +02:00
David Harper f52d70e5ba Add res module documentation
Closes #9793
2023-08-13 17:08:48 +02:00
Cédric Krier cc3b71bae4 Replace domain on view type by validation on view tree optional
The validation of type must be recursive up to the first inherited view which
cannot be expressed with a domain.

Closes #12341
2023-07-30 10:45:03 +02:00