Commit Graph
225 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 e9ee50982b Allow to update records when importing data
issue652
review273131003
2019-04-04 20:00:25 +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 bb0242faf8 Raise NotImplementedError when setting Function field without setter
issue7985
review265101002
2019-03-27 00:28:58 +01:00
Cédric Krier 44011b1435 Take the field type from the right definition
The field type should be taken from the current fields definition and not from
the class.

issue8212
review273131002
2019-03-22 18:25:52 +01:00
Cédric Krier 2752490423 Improve note button
* Add resources method to ModelStorage
* Support badge on icon
* Display unread and total of notes
* Add two extra colors for icon

issue8122
review70561002
2019-03-22 12:16:36 +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 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 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 1738a4ec35 Add ir.message and use custom exceptions
issue3672
review35291002
2018-12-29 14:19:08 +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 1a3ee131fe Check read access on field in search domain
issue7766
review50591002
2018-11-12 17:18:06 +01:00
Cédric Krier e115ef92d3 Remove check access to trigger_write_get_eligibles
The triggers returned need to be read without any check access.

issue7764
review68321002
2018-10-15 22:49:51 +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
Sergi Almacellas Abellana dab4d42237 Skip access rules when validating relation domain
issue7555
review62291002
2018-07-06 14:32: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 0d07dea2ac Return new records from copy following the input order
issue7512
review58291002
2018-06-24 16:48:27 +02:00
Cédric Krier 1eaea7d1de Do not validate Function fields even with setter
Their values should be already validated by the underlying storage and also
the domain validation requires to have a searcher.

issue7507
review48471002
2018-06-18 21:55:16 +02:00
Cédric Krier 5ca66d5ccf Add tree mixin
- Implement generic get_rec_name and search_rec_name
- Include recursive check

issue7383
review48281002
2018-05-12 00:45:55 +02:00
Cédric Krier d23d7c9ccb Do not call table_query for testing
Only the callable property of table_query is used to test if the ModelSQL uses
a table query or not.

issue5726
review47321002
2018-04-30 15:55:31 +02:00
Cédric Krier 60f167bcfe Add index method to order field set calls
issue7090
review46301002
2018-04-05 19:18:52 +02:00
Cédric Krier b197b6b13d Add cache for check_xml_record
This allows fast return when the checked model has no record in ir.model.data
which is the most common case. This allow to prevent to search for non
existing records.

issue7119
review37991002
2018-02-14 19:35:57 +01:00
Sergi Almacellas Abellana b53fcf111a Do not strip trailing zeros on Decimal digits validation
In order to support the 0 digits case rstrip was introduced in changeset
d3fec5da0dbdbut it breaks the case where the number of digits is high
as python uses manting representation when converting the float value
to string. This causes the last trailing zero is also removed which
breaks the validation.

issue7091
review37981002
2018-02-07 12:26:59 +01:00
Cédric Krier 21fd0496a1 Remove trailing 0 in exp of Decimal.quantize
The digits validation on Decimal should remove trailing 0 when create exp.
Because the string of "10.0 ** -0" is "1.0" because it is a float.

issue7091
review39111002
2018-02-02 00:08:22 +01:00
Cédric Krier b32d158d10 Remove MySQL backend
issue7017
review41771002
2018-01-24 20:12:42 +01:00
Cédric Krier c63d0f8188 Use integer division
The count of grouped_slice must be an integer and not a float.
2017-12-26 17:56:35 +01:00
Cédric Krier 10042b9597 Improve validation of PYSON domain
Use a different strategy if we are close to one domain per record.
It will use combined multiple domain at once instead of doing one query for
almost each record validated.

issue6983
review39021002
2017-12-26 17:28:42 +01:00
Cédric Krier 5b68d85117 Do not reset target link of one2many if it does not exist
The _save_values reset the target link of one2many because it will be set by
the setter. But when the one2many is a Function field, it may not have a
target.

issue6872
review42761002
2017-10-28 01:46:49 +02:00
Cédric Krier d3adf56163 Do not copy fields which are not ModelStorage or using table_query
It is not allowed to create/write/delete on such ModelSQL.

issue6819
review39751002
2017-10-13 23:31:33 +02:00
Cédric Krier 36c0ea7a1b Enforce required Reference field to have valid record
issue6749
review36661002
2017-10-11 22:41:05 +02:00
Cédric Krier a17386e970 Let default value of copy converted for the type of field
The default value of copy is expected to be the same format as for the default
methods. So the value for xxx2Many fields must be converted.

issue6818
review37751002
2017-10-06 11:00:41 +02:00
Albert Cervera i Areny 8f1242da3e Change rec_name label to "Record Name".
issue5643
review23211003
2017-10-02 20:19:10 +02:00
Cédric Krier 79fb0bcb7d Use next to get first record instead of index
This allows to use set with ModelStorage.save.

issue6633
review40521002
2017-07-19 19:57:30 +02:00
Cédric Krier fe674cef55 Enforce unique list of records on method calls
An option is added on RPC definition to enforce uniqueness of records
instantiated. The key methods ModeView.button and Workflow.transition have an
assert to detect error in development code.

issue6184
review36411002
2017-07-16 23:49:15 +02:00
Cédric Krier a908e8cc74 Add MultiValueMixin and ValueMixin and remove Propery
issue2349
review23351002
2017-04-01 00:24:55 +02:00
Cédric Krier 83e0b969b9 Allow digits with None values
issue6296
review30051002
2017-03-12 23:57:38 +01:00
Cédric Krier 92d8d29fad Do not instantiate reference field with negative id
The reference fields can have a negative id if no record was selected on the
client. It is not expected to get such temporary instance from a reference
field on a saved record.

issue6091
review26941002
2016-12-16 11:00:04 +01:00
Cédric Krier 6261fa486f Improve ModelStorage.search_count by using no order and COUNT(*)
issue5877
review27651003
2016-09-27 12:18:16 +02:00
Sergi Almacellas Abellana 35c3495bb9 Don't check access when executing trigger actions
issue5887
review27641002
2016-09-21 15:30:02 +02:00
Sergi Almacellas Abellana cca2b961b0 Allow records with different context on ModelStorage.save
issue5753
review22201002
2016-07-29 10:30:00 +02:00
Cédric Krier 1265f7c42f Reset context when saving records
The method set_context does not replace the context but just update it.
So we could have leak of the surrounding into the save context.

issue5614
review28341002
2016-06-27 19:08:04 +02:00
Cédric Krier 8d8c489c83 Reset context when reading fields for browsing
The method set_context does not replace the context but just update it.
So we could have leak of the surrounding into the read context.

issue5614
review25161002
2016-06-14 16:00:15 +02:00
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