Commit Graph
289 Commits
Author SHA1 Message Date
Cédric Krier a39dec543c Do not get domain from empty reference field
issue11074
2022-02-03 23:21:03 +01:00
Cédric Krier 632deb43e5 Use dictionary as domain for Reference field
issue11074
review383911002
2022-02-03 23:05:47 +01:00
Cédric Krier 5f34224215 Include model, field and column in import data error message
issue11132
review381701002
2022-01-30 12:58:51 +01:00
Cédric Krier 19ad886d45 Add limit to search count
issue10967
review389301002
2022-01-30 01:42:23 +01:00
Cédric Krier 7c822ccfda Use cached data also to instantiate records with context field
If all the context fields are already in the cache we can use them without
having to call read and avoid a SQL query.

issue11096
review387631002
2022-01-23 10:23:50 +01:00
Cédric Krier 2563aed9b0 Check read access on parent field of child/parent operators
The 4th element of the clause is the parent field for the child_of/parent_of
operators, so it must be used to check access as related field.
Also we must remove the 4th element when checking related domain.

issue11115
review391371002
2022-01-11 23:07:45 +01:00
Cédric Krier a0bfbfa255 Follow isort formatting
issue10928
2021-12-11 17:58:45 +01:00
Cédric Krier 7d879abef6 Use same context as clients to evaluate PYSON
issue10963
review372581002
2021-11-28 13:45:54 +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
Cédric Krier a97e769ad3 Evaluate invalid domain if there are many fields
We must find the field that is invalid instead of using the first one with a
domain constraint.

issue10418
review360371002
2021-10-30 02:20:23 +02:00
Sergi Almacellas Abellana b6678dfe19 Skip default values when copying records
This allows users with no write access to a field to copy records if their
values have not been modified.

issue10536
review336541002
2021-10-11 15:14:57 +02:00
Nicolas Évrard b3786087a9 Use global cache for Function fields in readonly transactions
issue10491
review352081002
2021-10-11 11:52:42 +02:00
Cédric Krier b038c04fee Ensure instances to be saved are from the class
issue10797
review372041002
2021-10-03 13:38:28 +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 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
Cédric Krier 5a78da0925 Add estimation count to ModelStorage
issue10623
review350381002
2021-09-04 19:40:02 +02:00
Cédric Krier 03e2a7f2dc Avoid instantiate set
issue10660
review342911003
2021-09-02 23:56:13 +02:00
Cédric Krier 1c3d67a96c Do not try to clean never filled _language_cache
The _language_cache is no more filled since rev 097a3b7df47c.

issue10653
review334681002
2021-08-27 09:05:23 +02:00
Cédric Krier a63de7ab07 Do not read deleted record as extra record
When a record from a browse list has been deleted, we must not try to read it
if other records are accessed.

issue10652
review346731080
2021-08-27 09:01:34 +02:00
Cédric Krier fb9238b8bf Add digits mixin
issue10596
review338511002
2021-08-21 09:05:34 +02:00
Cédric Krier 5bf6b08355 Ensure to read only validated records
The list of records can be part of a large browse list which may be also read
when accessing attribute of the record. To prevent that we must use a new
browsing list.

issue10632
review334631003
2021-08-16 23:07:06 +02:00
Cédric Krier 04b66919f7 Set field context when validate domain
issue10386
review336171002
2021-06-06 09:27:28 +02:00
Cédric Krier 056d15ede5 Support Binary field in CSV import/export
issue10350
review346101002
2021-05-18 22:08:59 +02:00
Cédric Krier 7cd224905e Do not use root user to validate records
It is no more needed as record rules are now ignored by _check_access.

issue10303
review357871002
2021-04-23 22:59:19 +02:00
Nicolas Évrard 0e73e59095 Update MPTT only for affected fields
issue10130
review353331002
2021-03-05 18:22:55 +01:00
Cédric Krier dcdd1707b4 Check record rule in button decorator
In order to relax internal control of record rules, they must be enforced on
the button entry point.
This is done by just reading the id of the records already stored.

issue7638
review349381002
2021-02-14 15:47:00 +01:00
Cédric Krier 0a7268f6ef Do not instantiate other fields loaded eagerly
It has a cost to instantiate such fields and there is not guarantee that they
will be used. But as their values are stored in the cache, if they are needed
they can be instantiated using only the cache values.
Also there is no real benefit in instantiate two fields together.

issue10026
review341251002
2021-02-13 11:15:16 +01:00
Cédric Krier 37d80d6f7f Update translate field of all copied records
The same record can be passed multiple times in the list. So we must update all
of the new records with the translated value of the fields.

issue9866
review353091002
2021-01-18 23:20:15 +01:00
Nicolas Évrard 750b597043 Use created_at text for create_date field
issue9902
review308761002
2021-01-07 10:52:08 +01:00
Cédric Krier b16604550c Skip access check on ModelStorage instances
There is no need to enforce access right on instances because only internal
code can use them and the design is to only check on the external calls.

issue7765
review322581002
2020-12-18 00:09:03 +01:00
Nicolas Évrard 1d29cbe2b8 Compute once selection field's value when possible
issue9222
review309331002
2020-12-11 11:57:10 +01:00
Sergi Almacellas Abellana 06346f0c76 Eager load Function field with same multiple getter
issue9561
review314201002
2020-12-06 18:34:19 +01:00
Cédric Krier 1618881692 Allow copying Python instances of Model
issue9869
review337071002
2020-12-05 11:58:41 +01:00
Sergi Almacellas Abellana 02d4e18e35 Remove unused overrided function in modelstorage
issue9863
review331351002
2020-11-23 17:55:20 +01:00
Cédric Krier 2bedebbccc Disable record rule when validating records
issue9796
review329451002
2020-11-11 20:33:18 +01:00
Cédric Krier a1671ab214 Forbid all white spaces except space in Char field
They can not be displayed by all clients (nor OS).
But also they can be trimmed automatically by web input which breaks comparison
against changes.

issue9248
review312681002
2020-11-05 23:58:15 +01:00
Cédric Krier 001245bf60 Support timedelta in CSV import/export
issue9220
review297531002
2020-10-11 19:04:16 +02:00
Cédric Krier bc1f29e6c9 Use the ids order to fill cache with read data
The shared cache is designed for loop usage so we must ensure that we fill the
LRU dictionary in the same order as the loop will request attributes.
So we must order the result of the read because the API does not return data in
the same order as the list of ids.

issue9518
review318041002
2020-08-10 23:24:02 +02:00
Cédric Krier d882e84c74 Delete read data after having instantiated all targets
Some read value may be needed to instantiate other records if it is used in the
context.
Also the test to fill fields dictionary was always false as it tested the field
instance instead of the name.

issue9380
review298171002
2020-07-13 20:55:53 +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 3242096509 Evaluate PYSON domain with the origin record
When a relation domain is not valid, the domain used to set on the exception
must be evaluated with the origin record and not the invalid target record.
We take the first origin record as any of the passed record will generate the
same domain per design.

issue9383
review317531002
2020-06-12 12:36:47 +02:00
Cédric Krier a48382124f Support explicit delete and remove for saving and on_change xxx2Many
issue4140
review291281002
2020-04-12 23:18:15 +02:00
Cédric Krier 5626018cd6 Add export CSV data route
issue9090
review261011002
2020-04-12 23:10:30 +02:00
Cédric Krier a2c783371d Do not use only cache if context depends on other fields
We must read all the required fields to set a correct context on the field.

issue9187
review297391002
2020-04-10 18:25:03 +02:00
Cédric Krier 34e5c61a1a Run trigger in the queue
This ensures that internal changes that are reverted later in the same
transaction does not trigger an action.
Also we ensure that a record is triggered by the same trigger only
once per transaction.

issue8342
review280971002
2020-03-28 17:13:12 +01:00
Cédric Krier 72a71019c0 Do not copy Binary content with file_id
This avoid the filestore to reprocess the binary data as the file_id is
already copied.

issue9153
review297241002
2020-03-28 16:57:05 +01:00
David Harper ba776f36a5 Replace memoize with functools.lru_cache
issue9081
review286781002
2020-03-25 17:34:35 +01:00
Cédric Krier d0a82c8bdc Support multiselection field in EvalEnvironment
issue9144
review285001004
2020-03-17 23:28:57 +01:00