Commit Graph
200 Commits
Author SHA1 Message Date
Cédric Krier e39129ee3d Add sort and translate options to Reference field
As Reference field uses the SelectionMixin, they could have the same options.

issue8278
review253331002
2019-04-15 16:11:00 +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 722db3252a Remove id to on_change calls that are cached
issue8234
review275131002
2019-04-08 10:14:39 +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 bb0242faf8 Raise NotImplementedError when setting Function field without setter
issue7985
review265101002
2019-03-27 00:28:58 +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 986da58a48 Use model name instead of class to translate field definition
The typo was introduced in changeset 1094d993d89c.
2019-03-09 15:23:11 +01:00
Cédric Krier f6c3fa2d68 Fill add_remove definition only if it is not None
issue8037
2019-02-18 17:03:13 +01:00
Cédric Krier 8a9d5297c6 Fill size definition only if it is not None
The clients expect to have an integer for the size or no key.

issue8037
2019-02-13 13:57:33 +01:00
Cédric Krier 9ea41ef4c8 Wrong class in super call
Introduced in changeset 5075df5e9872

issue8084
2019-02-13 12:30:05 +01:00
Cédric Krier 67cdf02720 Fill relation_field definition only with real field name
proteus expects the definition to have a field name for relation_field key or
no key at all. So parent_name is always a string.

issue8037
2019-02-13 11:38:16 +01:00
Cédric Krier 98bb26a386 Move field definition from Model to Field
issue8037
review74441002
2019-02-13 10:37:40 +01:00
Cédric Krier 951dbdfa82 Make DateTime field inherit from Timestamp field
The DateTime is a particular case of Timestamp.
This allows to share the sql_cast of DateTime with Timestamp.

issue8084
review64561002
2019-02-13 10:17:27 +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 93e3c0f9df Order selection field with instance method on column
issue7934
review66491002
2018-12-30 00:14:27 +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 c3d2be19f5 Add support of timestamp field on client
issue6463
review50521002
2018-08-01 11:37:09 +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 23ab0cdb13 Ensure second domain argument is a string before testing against OPERATORS
If the second argument is a PYSON expression, the Python 'in' test calls
__eq__ on it which return a PYSON Equal object between the expression and the
operator. If the PYSON expression does not have the string type, an
incompatibility exception is raised.
So this operation must be prevented if the argument is not a string.

issue7491
review45251003
2018-06-11 23:10:27 +02:00
Cédric Krier 4ed54e9bbc Support child_of/parent_of with None in the value list
This was a implicit behaviour before the changeset 6fefd00369c1.
As a lot of code rely on this behaviour, we make it explicit by adding a test
case.

issue7405
review36251002
2018-05-03 11:57:10 +02:00
Cédric Krier 4c1fe028c1 Use recursive common table expression for child_of/parent_of operators
issue7116
review46331002
2018-04-30 16:03:34 +02:00
Cédric Krier 00e4a51a41 Add sql_cast on Field
issue7266
review37141002
2018-04-30 14:59:01 +02:00
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