Commit Graph
182 Commits
Author SHA1 Message Date
Cédric Krier bfe9e5bea8 ModelStorage._clean_defaults must skip related fields
Related fields like '.rec_name' could be set as default value, they are not
defined in _fields and they must be cleaned.

issue5376
review17131002
2016-03-16 12:46:20 +01:00
Cédric Krier 9b94696b05 Speed up instantiation of Models
Pass as much possible, pre-computed parameters to __init__ to move their
computation outside the loop.

issue5294
review20721002
2016-03-15 19:01:47 +01:00
Cédric Krier 22dc3d23bc Remove __setattr__ from Model
This method is there to only skip the id attribute to be set using the field
__set__ but it has a cost as it is called each time an attribute is set.
So we store now the id value in the attribute '_id' which doesn't overload the
field and we adapt field __get__ for this new location.
The __getitem__ is also removed as it is deprecated since 2.6.

issue5296
review17031002
2016-03-04 00:19:18 +01:00
Cédric Krier 512808e151 Add LRUDictTransaction
issue5293
review22771002
2016-03-03 23:27:38 +01:00
Nicolas Évrard 2fef479575 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:51:57 +01:00
Cédric Krier af00126074 Allow to modify XML record with noupdate
issue5176
review19851002
2016-02-11 22:18:29 +01:00
Cédric Krier 29129855ec Add support for Python 3
issue3211
review7311002
2016-02-07 16:46:16 +01:00
Cédric Krier 5999bb231d Check all fields when writing a sequence of records, values
issue5167
review22631002
2015-12-16 13:47:33 +01:00
Cédric Krier 10af0ea078 Reset MPTT fields when copying records
The left/right fields must be reset to their default values to allow to compute
the correct new values. As it is common to forget this requirement when
implementing, it is safer to enforce this behaviour directly in the
ModelStorage.copy method.

issue5049
review16741002
2015-10-18 16:50:41 +02:00
Sergi Almacellas Abellana fe45917d0b Fix copy of translated fields when records aren't read in order
issue4720
review9231002
2015-05-01 12:07:36 +02:00
Cédric Krier a913a10d0f Add only fields define in context for read
instead of all the depend fields.

issue4401
review8111002
2015-04-11 13:35:28 -04:00
Sergi Almacellas Abellana f978d5e158 Use grouped_slice to validate domain relations
issue4625
review9081002
2015-03-19 18:41:20 +01:00
Cédric Krier 611b96c5f0 Add is_instance_method tool compatible with Python3
issue3211
2015-03-18 23:34:55 +01:00
Cédric Krier e631dbee65 Skip domain validation for Reference fields
issue4639
review8001002
2015-03-15 16:27:27 +01:00
Cédric Krier bcd28ca071 Remove safe_eval
We convert all the fields that were storing python code into PYSON.
We add a pyson attribute on field tag to store PYSON value.

issue4416
review6971002
2015-03-09 19:40:41 +01:00
Cédric Krier 71eebf25e5 Fix result order of search_read
read doesn't respect the order of the given ids but search_read has an order
parameter so the read result must be sorted using the index of search result.

issue3228
review11051002
2015-03-05 11:43:27 +01:00
Cédric Krier 32001bc6d6 search_global yields record instead of id
It is better for customization to yield record instead of id to prevent to
instantiate a second times the record.

issue4519
review6871002
2015-02-04 13:37:02 +01:00
Cédric Krier 38b59e0329 Remove Pool.object_name_list
This method is inefficient for testing existence of an item, it is better to
ask for forgiveness.

review12761002
2014-12-16 22:02:44 +01:00
Cédric Krier c144f8c349 Fix most flake8 errors
review8771002
2014-12-02 12:54:01 +01:00
Cédric Krier 360f39f89d Make cache size configurable
* Clean private context keyword in RPC
* Add cache section in configuration

issue4320
review10641002
2014-11-19 21:35:51 +01:00
Cédric Krier b13abebc81 Use dualmethod on ModelStorage.save
issue4197
review8671002
2014-11-01 11:52:55 +01:00
Cédric Krier fee97ca399 New API for on_change
Modify the instance instead of returning a dictionary.

issue4203
review8581002
2014-10-29 20:38:17 +01:00
Cédric Krier a2c8111f26 Use context to check model and field access
* Model and Field access checked only if _check_access is set
* Add check_access to RPC
* Add check_access to Wizard and Report

issue4081
review8481002
2014-09-17 21:43:53 +02:00
Cédric Krier e0b995abbe Refactore configuration to allow easy extention
issue3627
review7401002
2014-09-03 23:32:01 +02:00
Cédric Krier 349fc51a7f Use the context of the relation field for instanciation
issue4098
review13461002
2014-08-29 16:49:09 +02:00
Guillem Barba 1301551515 Use repr() to show value in digits_validation_error message
issue4083
review5471002
2014-08-04 18:19:55 +02:00
Cédric Krier cd2ac5c1b1 Add translated descriptor for Selection field
issue3679
review10401002
2014-08-04 16:50:59 +02:00
Cédric Krier fc2fa94e1c Missing migration to ModelData.load_values in check_xml_record
issue3918
review5421003
2014-06-28 14:57:12 +02:00
Cédric Krier baf21adf7f Improve validation of PYSON domain
Group the validation of PYSON domain by evaluated domain.

issue3948
review5351003
2014-06-08 00:41:57 +02:00
Sergi Almacellas Abellana f55e2c07d2 Fix KeyError when raising digits validation error.
issue3970
review8411002
2014-06-06 19:15:03 +02:00
Cédric Krier 67dfdc6a99 Make global cache depends on explicit context keys
This should prevent the invalidation of the cache when the context keys that are
changed has no influence onn the global cache.

issue3905
review6291002
2014-05-22 23:36:00 +02:00
Cédric Krier 3d556a69f0 Always write modified record of xxx2many
Even if the record is already added to the xxx2many field, it can be modified.

issue3855
review5181002
2014-04-18 19:31:47 +02:00
Cédric Krier eada306375 Always validate field that depends on Function fields
As it is not possible to know if a Function field has changed, field that
depends on it must always be validated.

issue3829
review4901003
2014-04-12 23:48:13 +02:00
Cédric Krier 7c151984e0 Let raise user error in import_data
issue3767
review4441002
2014-03-18 19:49:51 +01:00
Nicolas Évrard 498bc47097 Use create multi in import_data
review3011003
2014-03-16 20:45:12 +01:00
Cédric Krier 9d1dc45b6e Skip domain validation for Dict field 2014-03-16 15:30:13 +01:00
Cédric Krier 20028f86ec Fix wrong assumption to compute relations in domain validation 2014-03-16 15:28:53 +01:00
Cédric Krier f72b983c0f Check relation access in fields_get and for default fields in read
issue3750
review4261002
2014-03-15 11:01:14 +01:00
Cédric Krier a130816cbd Add support of domain for non-relation field
issue3743
review4181002
2014-03-15 10:44:45 +01:00
Cédric Krier 97ad256c00 Add unique filter on the cache ids in ModelStorage.__getattr__
_ids must be kept with duplicates because it is important to keep the right
order/proximity of records in the cache. But when reading the values, the ids
must be filtered to be unique to not read it twice.

issue3710
review3781003
2014-02-25 19:12:02 +01:00
Cédric Krier 66a5f7b6f4 When saving record don't store target link for one2many to create
When saving an instance if the relation field of a one2many item is set, it
should not try to save it as it will be replaced by the current record. And in
the worst case, the target set could not be valid and so it prevents to store
the instance which doesn't need of this target.

issue3501
review3601003
2014-02-24 19:20:47 +01:00
Cédric Krier d9e064dde6 Add memoize to import data search functions
As during the processing of imported data, there is no creation of new records,
the result of the search calls could be cached.

review2981002
2014-02-09 23:58:45 +01:00
Cédric Krier bc6acd08ee Drop support of Python 2.6
review2691002
2014-01-31 00:02:03 +01:00
Cédric Krier 905343c900 Add fields.depends decorator
issue3487
review2301002
2014-01-26 14:27:24 +01:00
Cédric Krier 390f196559 Validate only modified and dependant fields on model write
issue3445
review1371002
2013-12-23 20:47:25 +01:00
Sergi Almacellas Abellana e54317cfca Improve error messages by showing the failing value
issue3489
review1671002
2013-12-22 10:24:05 +01:00
Cédric Krier 472b7e5d57 Rationalize relation actions
* Remove relation field actions:
    - delete_all
    - unlink_all
    - set
* Rename relation field action unlink into remove

issue3457
review2271002
2013-12-20 12:32:07 +01:00
Cédric Krier f52fe8e45f Use a sequence of records, values in write
issue3499
review1641003
2013-12-19 14:44:01 +01:00
Laurent Defert d143acdd0a Add a 'copy' action to One2Many and Many2Many's set method
issue3341
review1271002
2013-11-19 11:04:33 +01:00
Cédric Krier 20bb98ec44 Fix wrong name collision fix introduced in changeset 1dd74c6f22e7 2013-10-06 10:23:06 +02:00