Commit Graph
173 Commits
Author SHA1 Message Date
Sergi Almacellas Abellana fb246e1315 Do not convert null values to zero in Decimal fields
Javascript Number converts null to 0, but the original value must be preserved
so we avoid converting null values to Decimal.

issue5846
review28711002
2016-09-05 13:14:22 +02:00
Sergi Almacellas Abellana a7370447b9 Remove already deleted records on on_write result
issue5771
review26521002
2016-08-17 10:57:09 +02:00
Cédric Krier 56e3197283 Manage null value in One2Many._set_value
null could be a valid value when the read fails and a default null value is
used instead.

issue5729
review26501002
2016-08-10 22:44:42 +02:00
Xavier Codinas 11f1ecd8df Add support for column sorting
issue5675
review31301002
2016-08-08 17:08:16 +02:00
Cédric Krier a077ee95eb Set 'default_rec_name' context key when query default_get
The last searched text is used as default rec_name

issue4136
review30351002
2016-08-04 23:57:03 +02:00
Nicolas Évrard b7a8f5b7d4 Call autocompletion when setting record value
issue5712
review31371002
2016-07-20 13:24:32 +07:00
Xavier Codinas e54476fe30 Always return promise in field binary get data
If record id negative, it must still return a promise.
The default value for data must be an empty list.

issue5676
review28431002
2016-07-15 20:52:41 +07:00
Sergi Almacellas Abellana 9b25b0d347 Ensure all values are set before resolving default_get
issue5681
review26471002
2016-07-08 09:23:48 +02:00
Cédric Krier 1acc508800 Limit readonly state for xxx2Many
issue5041
review21051002
2016-06-30 21:43:35 +02:00
Sergi Almacellas Abellana 04ce9b6715 Fix issubset implementation
Current implementation is not valid as it will return false when the element is
not present on one of the list, but it should return false only if the element
is not on both lists.

issue5669
review28391002
2016-06-30 10:44:06 +02:00
Sergi Almacellas Abellana ad5d55ca70 Display views when Many2One rec_name is loaded
issue5665
review28381002
2016-06-29 17:19:41 +02:00
Xavier Codinas b07e4521c4 Fix root parent condition
issue5668
review31271002
2016-06-29 14:31:25 +02:00
Sergi Almacellas Abellana 7225b275e8 Fix usage of apply function
issue5666
review22121003
2016-06-29 09:38:32 +02:00
Sergi Almacellas Abellana be752ccd74 Only validate loaded field when performing a sync validation
issue5658
review22111002
2016-06-23 09:48:24 +02:00
Cédric Krier c302fdf02b Call on_change's even if the field is readonly
This is not in the model part that the readonly must be enforced by only on the
widget side.

issue5637
review26361002
2016-06-21 13:30:40 +02:00
Sergi Almacellas Abellana 4109580aa6 Return a new promise for resolving attachments data
issue5632
review27361002
2016-06-09 17:43:39 +02:00
Sergi Almacellas Abellana a1e4a9f69c Fix context value used in expr_eval
Set the ctx.context variable to a defined context instead of an undefined one,
so all the expressions that search for context values are correctly evaluated.

issue5531
review18091002
2016-05-06 15:36:43 +02:00
Cédric Krier 7ac86ddc2f Fix readonly tests when user has only create access
The screen should not be read-only if the user is allowed to create record even
if he is not allowed to modify it. And it is the same for the save button.

issue5479
review19201002
2016-04-21 17:15:52 +02:00
Cédric Krier 6f770b6c47 Improve speed of setting default value on One2Many
The validation in set_default is useless when performed from a One2Many because
the parent record will validate it anyway.

issue5161
review20091002
2016-03-21 23:49:59 +01:00
Cédric Krier cd965b2fb6 Check required Many2One against null only
0 is a valid required value for Many2One

issue5373
review21831002
2016-03-16 22:00:11 +01:00
Cédric Krier 2d2c36eeff Add Note
issue4669
review17731004
2016-02-02 19:15:58 +01:00
Cédric Krier ec084c6043 Set parent field only if changed is requested
When set_on_change adds a record, we don't need to trigger the parent
on_change, otherwise it can lead to an infinite loop.

issue5278
review17781002
2016-02-02 19:08:12 +01:00
Cédric Krier 5cf8093d32 Fix default value of one2many in form view
- set_default should correctly pipe promises because One2Many.set_default can
  be not synchronous.
- set previous group parent only if it is not empty because Screen create a
  default not linked group.
- Screen.display should set current_record is not correctly set.

issue5135
review19791002
2016-01-22 14:43:19 +01:00
Cédric Krier 8f42d272d1 Record.defaut_get must return a promise which resolves with values
The promise doesn't always return the values if there is any autocomplete and
the promise is resolved before the set_default is called.
So we use our custom deferred that will be resolved after the call to
set_default and the autocomplete promises.

issue5222
review19721002
2016-01-13 21:04:20 +01:00
Cédric Krier 719519e22a Remove useless multiplication
issue5194
review21571002
2015-12-31 13:41:26 +01:00
Cédric Krier b80d05d197 Fix Field.get_data when data is already read
When data is already in _values, it should return a promise with it.
2015-12-27 19:24:39 +01:00
Cédric Krier aaf9e28ce7 Construct the Record.expr_eval context the same way as tryton
issue5122
review23641002
2015-11-15 12:41:13 -03:00
Cédric Krier a2faaebcbd Fix set_on_change of One2Many when value.add is not defined 2015-11-01 22:34:56 +01:00
Cédric Krier 461d795ee4 Manage size limit, add and pre_validate on One2Many
review17621002
2015-10-26 18:33:50 +01:00
Cédric Krier 62c85fbc64 Use get_loaded instead of testing empty _loaded
because it doesn't catch partially loaded.
2015-10-24 20:39:48 +02:00
Cédric Krier ffbcd73ee0 Use Record.cancel instead of clearing _loaded
Since changeset e6b3bc445b7a, the timestamp must be cleared if we reload the
record.

issue5065
review19571002
2015-10-23 23:52:38 +02:00
Cédric Krier f218a28f63 Fix validate when fields is undefined 2015-10-19 20:35:09 +02:00
Cédric Krier cb69ab8024 Always keep the oldest timestamp
The optimistic lock should be checked with the oldest timestamp to be safer.

issue2687
review21491002
2015-10-18 16:53:47 +02:00
Cédric Krier 0407303197 Implement _check_load
instead of forcing the load of every fields.
2015-10-16 15:54:38 +02:00
Cédric Krier ceb4360cc6 Sort array before compare in get_loaded 2015-10-16 15:53:41 +02:00
Cédric Krier 2f2bc1ae96 Manage path for setting current_record
review18681002
2015-10-16 01:43:02 +02:00
Cédric Krier e83c3fac55 Reload and call written only if record has something to save 2015-10-09 20:52:44 +02:00
Cédric Krier 61aeb845d2 Calling written should be done after the save to get the right id if it is a creation 2015-10-09 12:42:37 +02:00
Cédric Krier 2ba1b1acfc Make digits with null behaves like null digits
issue5019
review19531002
2015-10-08 19:42:08 +02:00
Cédric Krier 252d66d7d8 Ensure Float.get_client returns a string
otherwise 0 could be evaluated as False.
2015-10-06 15:33:17 +02:00
Cédric Krier 22ba269923 Remove default (16, 2) digits
trytond doesn't enforce any digits if it is None,
so the client must do the same.

issue4742
review22491003
2015-10-03 11:55:37 +02:00
Cédric Krier c496bff4a6 Fix parsing empty string for Float and Numeric
For Javascript, Number('') results into 0 instead of NaN.
2015-10-02 19:39:32 +02:00
Cédric Krier e9518bac6f Fix typo True -> true 2015-10-02 12:29:36 +02:00
Cédric Krier 643959f9d6 Add Dict widget
review24411003
2015-09-25 18:00:31 +02:00
Cédric Krier a59e017ce3 Correctly set xxx2many modified by on_change
set_on_change should not trigger any signal but it should register
the field as modified.

issue4968
review24431002
2015-09-24 22:52:03 +02:00
Cédric Krier 4f74bc89a5 Fix localize_domain to strip 4th element only for Reference field
The 4th element should only be removed is the localized field is a Reference
field otherwise it must be kept.

issue4975
review16621002
2015-09-22 22:54:41 +02:00
Cédric Krier a487f69c6c Fix wrong arguments in validation_domains with pre_validate 2015-09-06 21:17:19 +02:00
Cédric Krier 034dea5312 Check if field is loaded before adding its timestamp
issue4876
review20341002
2015-07-28 07:42:25 +02:00
Cédric Krier ea52c00bdc Fix jsonify of Decimal and ensure Decimal instance is always used
The string version of the Decimal must be used for json.
When Decimal instances are used in calulation with Number, the result is no
more a Decimal instance so it must be converted again.

review22341002
2015-07-26 16:12:51 +07:00
Cédric Krier 0ce7edc54d Fix parent model comparison when eager loading 2015-07-17 21:44:07 +02:00