Commit Graph
345 Commits
Author SHA1 Message Date
Nicolas Évrard fd0709aa71 Add implicitely write_date to read columns only when reading already other columns
issue10359
review361791002
2022-02-03 15:04:03 +01:00
Cédric Krier 19ad886d45 Add limit to search count
issue10967
review389301002
2022-01-30 01:42:23 +01:00
Cédric Krier a0bfbfa255 Follow isort formatting
issue10928
2021-12-11 17:58:45 +01:00
Cédric Krier e02c830159 Fill local cache of Function field instances with values
issue10936
review377511003
2021-11-28 13:40:30 +01:00
Cédric Krier a00d26dd3c Cache Function field getter without context in readonly transactions
issue10936
review367781002
2021-11-28 13:27:52 +01:00
Cédric Krier 1250c434af Do not store in global cache Function field
issue10936
review364331002
2021-11-14 23:54:52 +01:00
Nicolas Évrard b3786087a9 Use global cache for Function fields in readonly transactions
issue10491
review352081002
2021-10-11 11:52:42 +02:00
Nicolas Évrard 870981c561 Pass default class order to __search_query
issue10838
review383251002
2021-10-11 11:38:37 +02:00
Nicolas Évrard 2f4c0eb0a5 Include order columns in UNION-ed search queries
issue10790
review365991002
2021-10-06 17:20:40 +02:00
Cédric Krier d50fc36f22 Allow locking tables by calling ModelSQL.lock without records
issue10785
review359051002
2021-10-03 13:50:33 +02:00
Cédric Krier 66a0dcf2b5 Add stored path as alternative to MPTT
issue7177
review352501002
2021-10-03 01:14:08 +02:00
Cédric Krier 607dc3907b Search also for inactive foreign key
issue10782
review367581002
2021-10-03 00:31:21 +02:00
Nicolas Évrard 72e3bb74c7 Reconstruct local domain after split_subquery_domain
issue10761
review338921002
2021-09-28 16:44:12 +02:00
Cédric Krier 0e41c6940a Factorize the instantiation of LRUDict and LRUDictTransaction
We use default_factory to avoid create unnecessary instances. The
default_factory_with_key argument is added to LRUDict to pass the missing key
to the default_factory method. And we use an LRUDict also for the
Transaction.cache.

issue10726
review362531002
2021-09-26 22:55:52 +02:00
Nicolas Évrard d3a5e680a8 Use UNION for 'Or'-ed domain with subqueries
issue10658
review365781002
2021-09-15 15:16:40 +02:00
Cédric Krier 1b85c2d0f9 Restore threshold between rebuild and update MPTT
issue10623
review350381002
2021-09-04 19:40:33 +02:00
Cédric Krier f38a70d843 Do not rebuild tree of MPTT on nested creation
If the MPTT is updated before calling set of fields, there is no need to
rebuild the tree.

issue10670
review342941002
2021-09-04 19:31:30 +02:00
Cédric Krier 03e2a7f2dc Avoid instantiate set
issue10660
review342911003
2021-09-02 23:56:13 +02:00
Cédric Krier fa1b09c05e Remove delete attribute and use defaultdict from Transaction
issue10630
review369351002
2021-08-16 23:11:38 +02:00
Cédric Krier 1788bcb544 Check rule only if _check_access is set
issue4080
review343891009
2021-04-10 23:44:39 +02:00
Cédric Krier 9c81cb6a4a Replace cursor fetchall by iteration over cursor
issue5817
review335831003
2021-03-21 16:09:13 +01:00
Nicolas Évrard 55143f1009 Compute default values on creation only once per schema of missing default values
issue10131
review341491002
2021-03-12 12:33:30 +01:00
Nicolas Évrard 0e73e59095 Update MPTT only for affected fields
issue10130
review353331002
2021-03-05 18:22:55 +01:00
Nicolas Évrard eb78acc47b Call Function.get by bunch of cache size
issue9927
review324701002
2021-02-23 18:50:27 +01:00
Cédric Krier d766a67fbb Use cache to fill Reference selections
issue9235
review335301003
2020-12-27 00:19:30 +01:00
Cédric Krier 4f83dff439 Convert rule domain for _write and _delete without active test
We must convert in ModelSQL.read the rule domains like the ModelSQL.write and
ModelSQL.delete convert their rule without the active test to have the same
result.

issue9819
review300951006
2020-11-23 23:43:01 +01:00
Cédric Krier 1f013a7eec Convert read column into proper type with SQLite
As SQLite has few basic types, we must use column names cast parsing to ensure
to read values in proper type.

issue9652
review310801004
2020-10-21 23:11:13 +02:00
Nicolas Évrard 70b2c9b56c Manage deletable and writable state from ir.rule
issue9357
review290101002
2020-09-23 10:04:19 +02:00
Cédric Krier b3f8d125f9 Use custom class to store record data
By using a class with slots instead of standard dict, we can reduce a lot the
memory usage to store the record data in the caches and values.
Also we can rely on the data in the cache to exist only for real field which
can be used to create a fast path in ModelStorage.__getattr__.
As now storing data in the cache has no extra cost, we can store data from the
transactional cache in the local. This allow also to have a shorter path in
ModelStorage.__getattr__.
For more memory efficiency, we remove the record from the cache instead of
clearing them. It was better to clear a dict but a record is less expensive to
re-instantiate than clearing.

issue9369
issue9225
review297861002
2020-06-13 09:48:03 +02:00
Cédric Krier d7ed5f91f5 Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:54 +01:00
Cédric Krier a99931c5c4 Do use translation cache if records were modified after last synchronisation
On distributed setup, the cache is not synchronized instantaneously so we can
not use the cache if the record was modified by another process since the last
synchronisation.

issue9013
review262841002
2020-02-15 01:36:48 +01:00
Cédric Krier e118cb894a Apply Exclude where clause when searching other records
When we simulate the Exclude constraints, we must apply the where clause also
to existing records.

issue8954
review284651002
2020-01-13 23:58:14 +01:00
Cédric Krier 6b14518eff Position new record based on order
We sent an order to the client for action and xxx2Many so its screen has
always a default order set.
To position a new record on non editable tree, we use the order of the 'id'
column if presents.

issue8880
review276501003
2019-12-28 18:16:28 +01:00
Nicolas Évrard 8fb13634ea Use direct access to backend classes
issue8836
review258421002
2019-12-06 17:33:47 +01:00
Cédric Krier b8af68cf59 Do not check timestamp when it is None
issue8779
review268321002
2019-11-05 10:33:25 +01:00
Cédric Krier 34678d2be6 Backed out changeset f08b9ce07a7b 2019-11-04 16:05:28 +01:00
Cédric Krier 65650004c9 Update release number 2019-11-04 16:01:28 +01:00
Cédric Krier 0b5dc3e389 Compare timestamps as Char for inequality
Databases are too random about rounding when casting epoch into numerical
value. So it is better to check against inequality of the string.

issue8779
review254571002
2019-11-03 17:49:03 +01:00
Cédric Krier 7729badb30 Cast timestamp epoch into FLOAT to avoid rounding
On PostgreSQL-12, the epoch FLOAT is now 6 digits but rounded to 5 digits when
cast into NUMERIC.

issue8779
review264501002
2019-11-01 23:04:50 +01:00
Cédric Krier 4154b93a01 Prevent assign unknown attributes on Model
by adding __slots__ on PoolMeta

issue8567
review254091002
2019-09-07 23:45:08 +02:00
Cédric Krier 23dabd10b2 Always return 'id' key in the read result
The 'id' should not be removed from the result if a field use it as an extra
(e.g. for context).

issue8470
review263841002
2019-07-08 21:30:43 +02:00
Cédric Krier 5c2782626b Use freezed context in order function
The hash method can no hash tuple containing unhashable element like a list.

issue8265
review265341002
2019-04-25 15:24:01 +02:00
Cédric Krier 12376f30e5 Order by target name and context hash
None can not be compared to a class so we always use strings to order before
grouping. Also dictionary can not be compared neither.

issue8265
review253351002
2019-04-24 23:40:46 +02:00
Cédric Krier 3e9784c8d7 Set context on record instantiated in Field.__set__ and read related
Field may have a context defined so when it instantiate a relational record,
the field should set this context like when the record is read from the
database in ModelStorage.__getattr__.
And when such field is read as related field, the context should also be set.

issue8225
review287171002
2019-04-04 19:06:09 +02:00
Cédric Krier bb0242faf8 Raise NotImplementedError when setting Function field without setter
issue7985
review265101002
2019-03-27 00:28:58 +01:00
Cédric Krier 10e31bc311 Add Model.__names__ to retrieve model and field names
issue8159
review72431002
2019-03-15 12:27:44 +01:00
Cédric Krier c255cfe785 Display ids and rule names on access error
issue8093
review60551002
2019-03-03 23:11:17 +01:00
Cédric Krier b34cac78d5 Allow to lock records for update
issue8012
review45901002
2019-01-30 09:45:59 +01:00
Cédric Krier 83bf159aef Check foreign key in last on database integrity error
The search is done on a new transaction so it can not find targets that were
created during the main transaction.
2018-12-29 23:28:40 +01:00
Cédric Krier 1738a4ec35 Add ir.message and use custom exceptions
issue3672
review35291002
2018-12-29 14:19:08 +01:00