diff --git a/web_widget_datepicker_fulloptions/__init__.py b/web_widget_datepicker_fulloptions/__init__.py new file mode 100644 index 000000000..ef5ae3587 --- /dev/null +++ b/web_widget_datepicker_fulloptions/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/web_widget_datepicker_fulloptions/__manifest__.py b/web_widget_datepicker_fulloptions/__manifest__.py new file mode 100644 index 000000000..c19de87f5 --- /dev/null +++ b/web_widget_datepicker_fulloptions/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2021 Quentin DUPONT +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Web Widget DatePicker Full Options", + "version": "12.0.1.0.0", + "author": "GRAP, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Web", + "website": "https://github.com/OCA/web/", + 'installable': True, + "depends": [ + "web", + ], + "data": [ + "views/web_widget_datepicker_fulloptions_assets.xml", + ], +} diff --git a/web_widget_datepicker_fulloptions/readme/CONTRIBUTORS.rst b/web_widget_datepicker_fulloptions/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..65f8f81d1 --- /dev/null +++ b/web_widget_datepicker_fulloptions/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `GRAP `_: + + * Quentin DUPONT diff --git a/web_widget_datepicker_fulloptions/readme/DESCRIPTION.rst b/web_widget_datepicker_fulloptions/readme/DESCRIPTION.rst new file mode 100644 index 000000000..a0b41ca17 --- /dev/null +++ b/web_widget_datepicker_fulloptions/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module enables full options in datepicker used in date fields : +- Choose today's date in one click +- Three buttons enabled : show today, clear field, close datepicker + +.. figure:: ../static/description/change.png diff --git a/web_widget_datepicker_fulloptions/static/description/change.png b/web_widget_datepicker_fulloptions/static/description/change.png new file mode 100644 index 000000000..3d46cc8ea Binary files /dev/null and b/web_widget_datepicker_fulloptions/static/description/change.png differ diff --git a/web_widget_datepicker_fulloptions/static/description/icon.png b/web_widget_datepicker_fulloptions/static/description/icon.png new file mode 100644 index 000000000..d36d16c94 Binary files /dev/null and b/web_widget_datepicker_fulloptions/static/description/icon.png differ diff --git a/web_widget_datepicker_fulloptions/static/src/js/web_widget_datepicker_fulloptions.js b/web_widget_datepicker_fulloptions/static/src/js/web_widget_datepicker_fulloptions.js new file mode 100644 index 000000000..0dc96e52b --- /dev/null +++ b/web_widget_datepicker_fulloptions/static/src/js/web_widget_datepicker_fulloptions.js @@ -0,0 +1,21 @@ +/* Copyright 2021 Quentin DUPONT + * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */ +odoo.define('web_widget_datepicker_fulloptions.datepicker_fulloptions', function (require) { +"use strict"; + + var DatePicker = require('web.datepicker'); + + var DatePickerFullOptions = DatePicker.DateWidget.include({ + /** + * @override + */ + init: function (parent, options) { + this._super(parent, options); + this.options.useCurrent = true; + this.options.buttons.showToday = true; + this.options.buttons.showClear = true; + this.options.buttons.showClose = true; + }, + }); + +}); diff --git a/web_widget_datepicker_fulloptions/views/web_widget_datepicker_fulloptions_assets.xml b/web_widget_datepicker_fulloptions/views/web_widget_datepicker_fulloptions_assets.xml new file mode 100644 index 000000000..fc5533e4d --- /dev/null +++ b/web_widget_datepicker_fulloptions/views/web_widget_datepicker_fulloptions_assets.xml @@ -0,0 +1,12 @@ + + + +