diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-04-23 21:03:52 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-04-24 11:02:12 +0200 |
| commit | 54a90ca91910ea4345cf4261b80ea1cb7cfbae9d (patch) | |
| tree | e096c4b21f2eaa6f2f9336ccc65972c1456899b8 /addons/web/static/src/js/views | |
| parent | a765ff503d3d60eb1dbc3a2c175b60fcafdcd083 (diff) | |
[FIX] hr_holidays,web: proper use of toggle_boolean in list view
hr_holiday was the only module that used a widget=toggle_boolean on a
button in a list view. That behaviour was implemented as a column
widget in the previous list view, and was not reimplemented in the new
views. The feature is useful, but this was not done properly: it is
better to use a widget on a field (that was the intent) instead of doing
a weird hack like it was done.
With this commit, we update hr_holidays to use the ToggleBoolean widget,
which is supposed to work on every views.
Also, we fix the toggleboolean widget (it was not properly rendering
tooltips, and changes were not saved in readonly list view).
Note that it as the side effect of being better from the point of rpcs:
before, the list view had to reload itself. Also, another advantage is
that models do not need to implement custom methods (such as
toggle_payslip_status) just to toggle a boolean...
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_controller.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index d4d1fe9debe..06c27a61e94 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -269,6 +269,20 @@ var ListController = BasicController.extend({ new DataExport(this, record).open(); }, /** + * This method comes from the field manager mixin. + * @todo: there is a very similar method in kanban and form controllers. + * This should be moved in basic controller, and shared between basic views. + * + * @override + * @param {OdooEvent} event + */ + _onFieldChanged: function (event) { + if (this.renderer.mode === 'readonly') { + event.data.force_save = true; + } + this._super.apply(this, arguments); + }, + /** * changes of the list editable are automatically saved when unselecting the * row, which is done when clicking on 'Save' (anywhere outside the row * actually), so this function should only switch back to readonly mode |
