Commit Graph
199 Commits
Author SHA1 Message Date
Cédric Krier bfb2fcaa71 Rationalize context usage
issue7072
review43041002
2018-03-09 19:10:58 +01:00
Cédric Krier b2109d8297 Push record in on_change values if it is not deleted and not removed
issue7164
review43171003
2018-03-04 00:58:11 +01:00
Felipe Morato 2e6a660033 Format lang tags to comply with toLocaleString
Replace underscore for language tags to a hyphen because
toLocaleString expects a format of 'pt-BR' for composite tags while
tryton stores them with an underscore: 'pt_BR'.

issue7080
review41001002
2018-02-06 12:46:54 +01:00
Diego Abad 24ef842a26 TimeDelta converter take group as parameter instead record
issue6946
review35831002
2018-01-09 18:52:00 +01:00
Nicolas Évrard 782ac76137 Do not return empty action list for X2M field when getting a record value
issue6988
2017-12-09 16:23:50 +01:00
Cédric Krier 1944564f1c Use input number and toLocaleString for numeric fields
To get a proper virtual keyboard on mobile, it is needed to use a input of
type 'number' when editing a numeric field. But as it is not possible to
ensure to display non signifiant digits, a text input is used with the
toLocaleString method.
Also the lang attribute is repeated on the number input because not all
browsers manage to use the global as default.

issue5233
review43621002
2017-11-27 22:18:09 +01:00
Cédric Krier 9c0729a227 Call fields_view_get synchronously to always have the right domain parser
issue6887
review43661002
2017-10-30 11:37:27 +01:00
Cédric Krier 6ba8db35d1 Update field description when adding existing field
issue6886
review42781002
2017-10-30 11:35:51 +01:00
Cédric Krier b551d5c8f2 Modify loaded record in set_client and set_on_change of O2M
Since changeset d91743403415, only modified record are sent to the server, the
multiselection widget use set_client to store selected row so those record
must be marked as modified.

issue6855
review43611002
2017-10-21 10:48:37 +02:00
Cédric Krier 2b0f4ca685 Consider Reference field with negative record as empty
issue6749
review38791002
2017-10-11 22:43:12 +02:00
Sergi Almacellas Abellana fa41ccfeed Set current_record id on eval context
issue6826
review42701002
2017-10-06 14:40:18 +02:00
Cédric Krier da4b4d80ab Add only modified records of xxx2Many
issue6754
review38641002
2017-09-27 18:48:39 +02:00
Cédric Krier 02bbc2e572 Group load and remove must trigger a root display
The xxx2Many widget does not use set_client but load and remove.

issue6568
review42641002
2017-09-07 21:07:33 +02:00
Cédric Krier 43687122a2 Manage zero as stored id
issue6653
review38481002
2017-07-26 23:37:20 +02:00
Cédric Krier 376a67fd06 Skip validate only on constant readonly fields
A field can be readonly by the domain inversion in the validate method. So it
should be validated again in case its domain inversion change and reset it a
non-readonly.
So only field that are always readonly can be skipped for the validation.

issue6448
review38341002
2017-04-26 19:37:00 +02:00
Cédric Krier 484695ff59 Do not really remove records that do not have parent
The parent test is redundant with the force_remove flag. So be removing this
test, we activate the remove/unremove feature on WinForm without parent.

issue6342
review30131002
2017-04-12 15:41:56 +02:00
Cédric Krier 71c3b493fb Do not skip One2Many with readonly attribute for modified values
Since changeset edfb5803099a, the readonly state of one2many is not limited to
the modification of existing lines.

issue6256
review31081003
2017-02-14 00:07:24 +01:00
Cédric Krier 505d770a11 Load autocomplete only on display of Char widget
Keeping the autocomplete always up to date is very expensive especially for
large list because the method is called once per field for each record.
Indeed autocomplete is only needed when the Char widget is displayed. So we
could just load it at display and keep it up to date when fields are changed.

issue6167
review31871002
2017-01-13 20:04:53 +01:00
Cédric Krier e7ad2754a7 Set default value for new added fields to model group
Defines add_fields on Group and uses it instead of the one on Model.
This new method is used when setting group on Screen to ensure to trigger the
load of default values.

issue6058
review29781003
2016-11-28 00:14:45 +01:00
Cédric Krier 1092e979ad Order the keys of Dict value to allow comparison with JSON.stringify
This will ensure that the JSON.stringify will dump the keys always in the same
order. Even if the key order is a implementation detail of the browser,
constructing a new Object using always the same order will guarantee a stable
stringification.

issue6045
review33631002
2016-11-21 21:00:43 +01:00
Cédric Krier eb95cbeeff Remove old record in One2Many._set_value only if it is not in the new value
Always removing previous record makes the parent record being wrongly
considered as modified.

issue6044
review34451002
2016-11-21 20:59:33 +01:00
Cédric Krier 239470c997 Wait default_get before displaying new record
Soft validate the record when setting new fields.
And ensure correct default value for validate parameter in set_default.

issue5822
review32791002
2016-11-21 20:58:23 +01:00
Cédric Krier 662bee311b Add support for button rule
issue5944
review28911002
2016-10-26 09:45:38 +02:00
Jan Grasnick 7c3f2a2072 Add support for datetime_field to Many2One, Reference
issue4579
review30671002
2016-10-26 09:37:06 +02:00
Cédric Krier d950a96805 Do not apply screen domain on xxx2Many field
The screen domain on those fields only means at least one record
and not all records.

issue5948
review30621003
2016-10-25 23:12:12 +02:00
Cédric Krier b4900eda05 Empty value in O2M should remove existing record
The changeset 5efdef4c2c7d wrongly skip the removal of existing record in the
group. So it was not possible to remove the last record of the field.

issue5878
review34271002
2016-09-15 22:23:50 +02:00
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