Commit Graph
233 Commits
Author SHA1 Message Date
Cédric Krier def268915a Add MultiSelection field
issue7851
review249911002
2019-09-20 11:32:56 +02:00
Sebastien Marie afd08618f0 Import zero value as non null value
issue8658
review282121004
2019-09-17 23:12:51 +02: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 340cb2f630 Loop over all expression of the relation domain to valid
When the field is a relation, the field name can not be used to inverse the
domain because the record evaluated it the Relation. So we inverse the domain
with all the field in the domain until find one invalid. If we find any then we
raise a generic error.

issue8597
review270141002
2019-08-28 22:31:22 +02:00
Cédric Krier 589e27cc87 Add lazy_gettext
issue8560
review283901002
2019-08-25 13:00:28 +02:00
Cédric Krier ca8e1a088d Use non grouped domain when grouped record > IN_MAX
The break when grouped records are greater than IN_MAX, should break all the
loops in order to prevent use of the grouped domain.

issue8474
review257701002
2019-07-13 00:08:30 +02:00
Cédric Krier 2d4f6766b1 Improve domain validation error from server
We add to DomainValidationError the invalid domain and the field definition so
the client can format and append it to the description of the error.

issue8288
review255351002
2019-06-16 19:04:55 +02:00
Cédric Krier 2d0002d8e9 Allow to search on related field in search box
The server adds to the definition of the fields, the definition of relation
fields up to specific deep level.
The clients use this relation fields definition to extend the domain parser
with those fields using a dot notation. But those "dotted fields" are not
shown in the search filter to not bloat the popup as it is dedicated to
learning.
In addition, Dict fields are also filled with relation fields coming from the
keys defined in the schema model. As the size can very large, it is possible
to deactivate this feature from the configuration.

issue8293
review259391005
2019-06-16 15:44:14 +02:00
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