Commit Graph
155 Commits
Author SHA1 Message Date
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
Cédric Krier 2f838171ec Add force_reload on save and return reload promesse 2015-07-17 18:01:48 +02:00
Cédric Krier 0392294aa5 Remove colors on widgets
- Bold label of required fields
- Explicit error message for invalid record

issue4861
review21301002
2015-07-16 22:36:11 +02:00
Nicolas Évrard bd5fc134cc Only call autocomplete on in default_get if it depends on at least one field 2015-05-29 13:35:28 +02:00
Cédric Krier 8a110d9d2d Fix validation of record of One2Many field
review16301002
2015-05-22 11:04:06 +02:00
Cédric Krier 0ad99276d0 Remove TODO about validate as it is implemented 2015-05-15 13:45:51 +02:00
Cédric Krier ca9daa057c Remove useless TODO in One2Many.set_client
Parent is managed in changed call.
2015-05-15 13:45:33 +02:00
Cédric Krier 7ff523950e Remove TODO about signal management
sao doesn't uses signals but directly lookup for parents
2015-05-15 13:44:09 +02:00
Cédric Krier 3f6ff2ad03 Add readonly check in Field.changed 2015-05-15 13:15:33 +02:00
Cédric Krier f6149f4483 Remove useless TODO in Field.set_client
Parent is managed in changed call.
2015-05-15 13:11:20 +02:00
Cédric Krier 9f4a88d18e Add pre_validate
review15381002
2015-05-15 13:00:41 +02:00
Cédric Krier 5a8d38a905 Add autocompletion
review17261002
2015-05-07 11:21:29 +02:00
Cédric Krier a79cdf675d Force parent in default_get 2015-04-30 17:44:14 +02:00
Cédric Krier dbea601a79 Delay setting O2M field on record 2015-04-30 16:27:15 +02:00
Cédric Krier 8951d99ade Manage exception on Record and readonly state 2015-04-30 13:57:29 +02:00
Cédric Krier 0d6d6f2034 Implement sibling group load 2015-04-30 12:56:35 +02:00
Cédric Krier a838eb4e5e Wrong usage of Record.model_name instead of Record.model.name 2015-04-30 12:54:49 +02:00
Cédric Krier e8e6fecc2d Filter leaf domain of Reference fields
The domain of Reference fields must be filtered out for non-valid target
because the localization will remove the target part and thus generate an
invalid domain for the specific target.

issue4680
review11141003
2015-03-30 22:37:52 +02:00
Cédric Krier e2e6a9c004 Save parent group when saving record 2015-03-27 18:24:19 +01:00