Commit Graph
417 Commits
Author SHA1 Message Date
Cédric Krier 5b355f37d0 Check access on target only if related field has a target
The Dict field can use the relate syntax to access keys but it does not have
any target model to check.

issue8298
review251291002
2019-04-24 23:46:59 +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 eb3882e113 Verify keys of fields and buttons states
issue8262
review279221003
2019-04-12 13:08:01 +02:00
Cédric Krier 4b4c57a362 Add duration on Cache
issue8249
review283181002
2019-04-11 18:35:25 +02:00
Sergi Almacellas Abellana 49b7238d3f Add strip wildcards helpers
issue7347
review64541002
2019-04-11 15:17:30 +02:00
Cédric Krier e9ee50982b Allow to update records when importing data
issue652
review273131003
2019-04-04 20:00:25 +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 34316ae615 Check read access on field in search order
issue8189
review279061002
2019-04-02 19:01:33 +02:00
Cédric Krier 792ebac88b Use locale format for data export and import
issue8196
review255151002
2019-03-28 19:22:49 +01:00
Cédric Krier 07d79c7861 Validate selection format in Dict schema
issue7947
review257131002
2019-03-22 11:46:52 +01:00
Cédric Krier 45946c23ef Wait up to 10 seconds for cache sync in tests
On busy host, it may require some time to receive the notification.

issue8198
review269141003
2019-03-16 14:56:32 +01:00
Cédric Krier e2318257bb Allow to extend Field string and help
Those attributes are stored as StringPartitioned and each part creates its own
translation record. The translated strings are constructed by concatenation of
each translated part.

issue8040
review46731002
2019-03-15 13:01:11 +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 e5e92ac81a Allow to use channel to synchronize Cache
When the clear timeout of the cache is zero, we launch a thread to synchronize
caches if the back-end support channels.
The thread is started on the first call to sync for the database.
The channel is also used to clear the cache of the process initiating the
clearing. This allows to test the mechanism is working with a single process.
So there will be a small delay even on single instance.

issue8027
review68431002
2019-03-09 17:03:38 +01:00
Cédric Krier f9622e9b2d Test XML-RPC dumps using allow_none
issue8143
2019-03-09 00:12:23 +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 c4ddbb064a Prevent filling cache with data from old transaction
Once the cache has been cleared, we must ensure that transaction started
before the clearing cannot fill the global cache.

issue8019
review56541002
2019-03-02 23:11:14 +01:00
Cédric Krier 9eaac0f3a3 Cast timestamp as datetime for sqlite back-end
SQLite backend returns a string for the datetime so the comparison between
timestamp fails.

issue8080
review48721002
2019-02-13 10:23:44 +01:00
Cédric Krier b315e9a6d9 Do not update db_id when deleting XML record without noupdate
If the record has been removed from the XML file, the db_id field will be
required. So we must not update it and let convert delete the data in
post_import.

issue8051
review70521002
2019-02-03 20:33:01 +01:00
Cédric Krier 774d6eeb5a Do not keeping lock when relaunch listener and join listener in test
We can not recursively call Bus._listen when holding the lock because it
blocks all subscription until the listener stops.
The tearDown of the test should ensure the listener is really stopped before
ending.

issue8039
review52611002
2019-01-30 10:04:11 +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 23c81ec015 Avoid to store in transactional cache former translation value
Translated fields are stored in the transactional cache. Using the instance to
get the source value when it is being set, store the former value into the
cache and the source.

issue7997
review58471002
2019-01-30 09:36:21 +01:00
Cédric Krier 1c4067891e Do not start a transaction to init database
An uninitialized database does not have the ir_cache table so Transaction.start fails.

issue8032
review72391002
2019-01-28 09:15:33 +01:00
Cédric Krier da24071467 Make Cache transactional
We implement sync, commit and rollback to follow transaction semantic.
When a transaction clears a cache, the global cache is cleared only when the
transaction is committed meanwhile the transaction will use a cache for itself
only.
We remove _nocache option because the sync, commit and rollback operate only
for the transaction.

issue7975
review53521002
2019-01-18 11:57:11 +01:00
Cédric Krier 889b1cc9f8 Allow to search and order on Dict key value
issue7905
review62391002
2019-01-18 11:32:47 +01:00
Cédric Krier 0dc396904f Add extras modules to ModuleTestCase
issue7935
review50661002
2019-01-17 17:22:22 +01:00
Cédric Krier dde7250537 Correctly test required reference with None and negative id 2019-01-08 10:47:38 +01:00
Cédric Krier c39858aac7 Allow to delete record from XML with noupdate
We set the db_id to None to avoid to link later to a different record.

issue7668
review50671002
2019-01-07 22:08:52 +01:00
Cédric Krier 4679d1c910 Add ir.calendar for month and day
This allows to replace time_locale and use the translation infrastructure
instead. So it can be customized using the translation override or derivative
languages.
This provides also a standard base to modules that needs calendar month and
day.

issue7815
review56451002
2019-01-01 15:47:23 +01:00
Cédric Krier 5cab9c3995 Add test ordering of selection field
issue7934
review66491002
2018-12-30 00:14:59 +01:00
Cédric Krier 1738a4ec35 Add ir.message and use custom exceptions
issue3672
review35291002
2018-12-29 14:19:08 +01:00
Cédric Krier d1bb790cb8 New API to read related fields
issue7888
review58431002
2018-12-21 23:41:56 +01:00
Cédric Krier c7f5c54a83 Remove implicit fields names in ModelStorage.read
It is a bad practice to not explicit the fields to read. So we should not
support it.

issue7830
review54421002
2018-11-28 10:05:01 +01:00
Cédric Krier c0510b0ec2 Refactoring test account and include search
issue7766
review50591002
2018-11-12 17:19:24 +01:00
Cédric Krier 99580a2e6a Ensure to rollback and clean cache on exception
Exception raised in a test decorated by with_transaction should always clear
the cache to avoid leaking to other tests.

issue7829
review64471002
2018-11-07 19:02:34 +01:00
Cédric Krier 39ea946edd Remove custom strftime for year before 1900
The bug has been fixed in Python 3.3

issue7814
review48671002
2018-10-31 18:15:57 +01:00
Cédric Krier 9ebba6207b Fix argument order to Bus.publish in notify
issue7807
review51571002
2018-10-26 23:24:09 +02:00
Cédric Krier a6a7325f46 Remove deprecation warning
- remove invalid escape sequence
- use  read_file instead of read_fp
- use importlib instead of imp and __import__
- use callable instead of instance of collections.Callable
- fix silent file closing
- replace SafeConfigParser by ConfigParser
- replace decodestring by decodebytes
- replace encodestring by encodebytes

issue7666
issue7390
review53361004
2018-09-01 17:06:28 +02:00
Cédric Krier d221e36653 Improve ModelStorage.copy
* Allow callable in copy default
* Support dotted notation in copy default
* Use setdefault in copy
* Copy default when needed
* Do not set default state in copy
* Use callable and dotted notation in copy default

issue5576
issue7648
review72291002
2018-09-01 01:02:04 +02:00
Nicolas Évrard eb04b82822 Add bus management
issue7537
review66341002
2018-08-30 11:15:01 +02:00
Cédric Krier fac1c92bef Use passlib
issue4161
review51461002
2018-08-25 13:06:05 +02:00
Cédric Krier 2542224ce5 Add pyson TimeDelta
issue7351
review47651002
2018-08-18 17:19:33 +02:00
Cédric Krier 507a06a107 Use sqlite3.backup when available
issue7212
review44131002
2018-08-06 19:05:44 +02:00
Sergi Almacellas Abellana 3158279cb3 Remove button if it is not allowed to access some of its dependant fields
issue7502
review47511002
2018-08-01 10:44:06 +02:00
Sergi Almacellas Abellana 26f775e0b4 Add test for recursive dependant fields without access
issue7501
review46551002
2018-07-11 16:23:11 +02:00
Cédric Krier 9681897041 Implicit conversion to boolean in PYSON statement
issue7528
review58271002
2018-07-10 16:55:37 +02:00
Cédric Krier 08d57b436d Remove cdecimal dependency
It is no more needed as it is standard under Python3
2018-06-27 10:42:15 +02:00
Cédric Krier f72767bb6c Remove mock from tests requirements 2018-06-26 19:59:01 +02:00
Cédric Krier d2a461390a Remove support for Python 2.7
issue7497
review53261002
2018-06-26 19:11:19 +02:00
Cédric Krier 93526b9cd0 Check rule after indirect fields and modification
The rule may depend on indirect field written latter so it must be checked
after the storage of those fields.
On write, the rule must be checked before the modification but also after to
ensure users do not generate records that they can not modify after.

issue7403
review53301002
2018-06-24 16:54:46 +02:00