Commit Graph
178 Commits
Author SHA1 Message Date
Cédric Krier 710c0ab2e9 Rename with_inactive_records decorator
issue7026
2018-04-03 14:55:01 +02:00
Cédric Krier 8c61a67c2b Remove active test in search_domain of Many2One and Reference
As the target is stored on the record, the target is always visible so
searching on it should not add active clause.

issue7026
review41231002
2018-04-03 13:20:37 +02:00
Nicolas Évrard ff5b79819b Add support for search_* attributes on relational fields
issue6081
review25871002
2018-03-21 17:59:55 +01:00
Nicolas Évrard acdbe5a08f Allow to perform unaccented searches on Char fields
issue7115
review44611002
2018-03-16 18:17:53 +01:00
Cédric Krier 478c4e6928 Refactor fields tests
issue7085
review40051002
2018-02-02 00:04:19 +01:00
Cédric Krier 2d2ec90141 Use field name to call searcher or domain of Function field
The name from the domain may be nested.

issue7015
review44511002
2017-12-26 17:26:00 +01:00
Cédric Krier 8cfd0eb692 Use JSON canonical form for Dict value
It allows to make equality comparison.

issue7013
review39041002
2017-12-20 19:26:44 +01:00
Cédric Krier af498348a7 Allow to search and order translated fields using the derivative translations
Since rev 049635454a98, translations are derivatives so the search and order
must be done using all the parent languages.

issue6934
review39971002
2017-12-18 17:45:37 +01:00
Cédric Krier 87bbc9ee1a Apply filter when searching on xxx2many with one
The changeset b16a085824ce, which implements the filter, did not update the
search_domain of the fields to also apply the filter on the searched result.

issue6871
review36721003
2017-10-24 22:19:40 +02:00
Cédric Krier 83656053c8 Order operation on relational field to avoid constraints
The order on which the operations are applied can trigger constraints.
So it is safer to first delete then write and finally create.

issue6790
review43511002
2017-09-28 23:44:48 +02:00
Cédric Krier 9eafd65d2e Add translated descriptor for Reference field
issue5667
review39671002
2017-09-26 01:25:26 +02:00
Sergi Almacellas Abellana b637c503e7 Only convert dict fields when they are strings
issue6382
review28101002
2017-06-09 13:22:42 +02:00
Cédric Krier 8479768619 Ensure Many2One target join is unique if Target has history
The joins added in tables must ensure to make a Cartesian product.
So when joining on a history table, the target id is not unique so the latest
must be used only for the join. Otherwise a search query may return multiple
times the same id.

issue6458
review37341002
2017-04-26 19:33:32 +02:00
Sergi Almacellas Abellana 7cc9585630 Ensure all _parent_ values are set on fields.depends
If the client does not sent all the values of the parent model fields, we must
ensure that the empty ones have None value

issue6450
review40271002
2017-04-26 13:56:30 +02:00
Cédric Krier a178546d0d Use _field for sql_format of Function field
It is useful to allow to use sql_format on Function field when writing SQL
query that emulate the field.

issue6410
review34051002
2017-04-01 19:55:35 +02:00
Cédric Krier a908e8cc74 Add MultiValueMixin and ValueMixin and remove Propery
issue2349
review23351002
2017-04-01 00:24:55 +02:00
Nicolas Évrard 5cee718423 Move low level handling of the SQL type to the backend
This changeset defines on the field the (somehow) abstract SQL type a field
should use letting the duty of specifying the real SQL type the database
supports and the conversion to/from the python types to the backend.

issue6351
review33951002
2017-03-31 12:44:22 +02:00
Sergi Almacellas Abellana 95e000c9e8 Add filter to xxx2Many fields
issue4005
review32001002
2017-03-30 09:40:41 +02:00
Cédric Krier e7ff9ee619 Use compact separators to dump json
issue6373
review33991002
2017-03-23 22:51:36 +01:00
Cédric Krier 1124d15853 Support complex domain with where clause on Many2Many
issue6272
review33841002
2017-02-20 23:16:54 +01:00
Nicolas Évrard 39c12cf496 Add set_rpc on Field
The __rpc__ attribute is currently filled by method in ModelView. Allowing
fields to define themselves what endpoints should be remotely callable make
this process more flexible.

issue4044
review30991002
2017-02-01 16:11:00 +01:00
Cédric Krier 37cd24210a Use integer as default value for id when compare to 0
In Python3, it is no more allowed to compare None with integer.

issue6231
review27941002
2017-02-01 10:29:54 +01:00
Sergi Almacellas Abellana 8339247071 Ensure add_remove attribute is a valid domain
issue6230
review34671002
2017-02-01 10:15:12 +01:00
Cédric Krier dd3e0a4c2a Improve assertion in convert_domain of Function field
The field name from the domain could be a nested if the Function field is
relational. So it must just if it starts with the name of the field.
2016-12-22 01:15:46 +01:00
Cédric Krier f6deed5941 Allow to use domain_<field name> method with Function fields
issue6113
review26961003
2016-12-21 23:08:30 +01:00
Cédric Krier f9c0457416 Remove support for simplejson
On Python 3, simplejson has a different behaviour than the stdlib json,
especially for dumping bytes.

issue6010
review33601002
2016-11-05 19:54:12 +01:00
Cédric Krier 21e4b96fea Support selection method in TranslatedSelection
The Selection field could have a method name as selection so
TranslatedSelection must call this method to get the selection values.

issue5999
review27791002
2016-10-31 17:19:47 +01:00
Jan Grasnick 1eadd71f98 Add support for datetime_field to fields.Reference
issue4579
review26811002
2016-10-21 12:52:26 +02:00
Cédric Krier 972a1b6c91 Do not link the cache of the instances if id is negative
Otherwise trytond will try to read it from the database and fail.

issue5874
2016-09-22 11:33:51 +02:00
Cédric Krier bf7148d9d3 Link the cache of the instances in xxx2Many setter
Just as it is done when browsing xxx2Many field, the instances set by the
xxx2Many fields should share the same local cache.

issue5874
review30471002
2016-09-21 00:36:49 +02:00
Cédric Krier 5a9ea33f85 Add Many2Many targets to all records
If at least one record had already the target, the target was not added to any
records. This is because the test for existing link was only done on the target
id instead of the tuple origin and target.

issue5792
review26551002
2016-08-19 21:34:47 +02:00
Cédric Krier 7ca7f4c6f0 Allow to store Binary field in filestore
Two options are added on Binary field to define the column to use to store the
filestore id and the prefix to use.
Those options are used for Attachment and are configurable with conservative
default values.

issue5692
review25471003
2016-07-29 10:51:53 +02:00
Cédric Krier b2e5e20a06 Remove remaining files with sha field
issue3713
2016-07-11 18:34:43 +02:00
Cédric Krier 4d58b3a720 Don't remove from context the format of Binary fields
The getter of the Binary field could be called many times in the same
transaction, so popping out the format from the context create a side effect
that changes the requested format.

issue3774
review19981002
2016-03-05 17:26:27 +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
Nicolas Évrard 2fef479575 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:51:57 +01:00
Nicolas Évrard 9aa648513e re-add the use of the case removed in changeset 0c62b08fa917
Removing the case resulted in the evaluation of expression that were not valid
like the cast of a string into an integer.

issue5335
review16011002
2016-02-19 12:43:12 +01:00
Cédric Krier 29129855ec Add support for Python 3
issue3211
review7311002
2016-02-07 16:46:16 +01:00
Nicolas Évrard d4e3b605ef Add 'where' operator to xxx2many
issue4507
review12951002
2016-01-21 10:48:32 +01:00
Cédric Krier a61474274a Add parent_of operator
issue5037
review15711002
2015-11-05 23:22:26 +01:00
Cédric Krier b5479332d9 Use instance context in translated descriptor of Selection field
It is more expected from the translated descriptor to return translation in the
language from the instance instead of the current context.

issue5028
review15701002
2015-11-03 12:20:49 +01:00
Cédric Krier f01f0d5871 Fix child_of domain on empty MPTT
When the MPTT search returns no row, the SQL query generated has an invalid
syntax because it uses an empty Or() clause. We replace this empty Or() by a
Literal(False) to select nothing.

issue5011
review18651002
2015-10-03 11:50:56 +02:00
Cédric Krier fe52324943 Improve SQL expression for child_of on Many2One with MPTT
issue4984
review22441002
2015-09-24 15:48:45 +02:00
Cédric Krier c18ec6ba74 Add support for float and integer on Property fields
issue4942
review18531002
2015-09-14 10:37:38 +02:00
Cédric Krier c6c6c7e268 Fix join target_search for history
search_domain must not override the main table with the history instance if
tables is provided by the caller. In such case, it must assume the caller will
pass the right table.
The join search on Many2One must use the history table if the Target is
historized and a _datetime is set in the context.

issue4798
review12251002
2015-07-28 14:54:03 +02:00
Cédric Krier 390aebef15 Simplify the SQL query for domain on property
- Remove useless CASE test
- Simplify double negation

issue4835
review21271002
2015-07-09 15:38:44 +02:00
Cédric Krier 808580e2ea Improve domain queries of xxx2Many
Avoid using double select of ids and origin.

issue4821
review15521002
2015-07-09 15:37:03 +02:00
Cédric Krier a739a80228 Fix Rule.domain_get usage in many2one
Since changeset a96d8a738cee, Rule.domain_get returns a domain instead of SQL
expression.
2015-06-15 02:19:49 +02:00
Cédric Krier 5478e5463f Don't use subquery to enforce record rule
Rule.domain_get returns now only a domain and Rule.query_get returns the query
which domain_get used to.

issue4800
review8151002
2015-06-15 01:14:47 +02:00
Cédric Krier 0c4725b891 Add target_search option on Many2One
The option allow to select between the subquery or the join format for target
search clause.

issue4798
review16341002
2015-06-15 01:10:59 +02:00