diff --git a/static/src/js/datepicker.js b/static/src/js/datepicker.js deleted file mode 100644 index 304f119b..00000000 --- a/static/src/js/datepicker.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - OpenERP, Open Source Management Solution - This module copyright (C) 2015 Savoir-faire Linux - (). - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -/*global openerp, _, $ */ - -openerp.web_widget_datepicker_options = function (instance) { - - "use strict"; - - instance.web.form.FieldDatetime.include({ - initialize_content: function() { - this._super(); - var self = this; - if (this.datewidget) { - if (typeof this.options.datepicker === 'object') { - $.map(this.options.datepicker, function(value, key) { - self.datewidget.picker('option', key, value); - }); - } - } - } - }); - - instance.web.form.FieldDate.include({ - initialize_content: function() { - this._super(); - var self = this; - if (this.datewidget) { - if (typeof this.options.datepicker === 'object') { - $.map(this.options.datepicker, function(value, key) { - self.datewidget.picker('option', key, value); - }); - } - } - } - }); -}; - diff --git a/README.rst b/web_widget_datepicker_options/README.rst similarity index 97% rename from README.rst rename to web_widget_datepicker_options/README.rst index f21fe3d5..aae7b04f 100644 --- a/README.rst +++ b/web_widget_datepicker_options/README.rst @@ -42,6 +42,7 @@ Contributors ------------ * Vincent Vinet +* Yanina Aular Maintainer ---------- diff --git a/__init__.py b/web_widget_datepicker_options/__init__.py similarity index 100% rename from __init__.py rename to web_widget_datepicker_options/__init__.py diff --git a/__manifest__.py b/web_widget_datepicker_options/__manifest__.py similarity index 94% rename from __manifest__.py rename to web_widget_datepicker_options/__manifest__.py index 67b23c1e..40522db8 100644 --- a/__manifest__.py +++ b/web_widget_datepicker_options/__manifest__.py @@ -22,7 +22,8 @@ { "name": 'web_widget_datepicker_options', - "version": "8.0.1.0.0", + "version": "11.0.1.0.0", + "license": "AGPL-3", "depends": [ 'base', 'web', @@ -32,6 +33,5 @@ ], "author": "Vincent Vinet, " "Odoo Community Association (OCA)", - 'installable': False, - "active": False, + 'installable': True, } diff --git a/static/description/icon.png b/web_widget_datepicker_options/static/description/icon.png similarity index 100% rename from static/description/icon.png rename to web_widget_datepicker_options/static/description/icon.png diff --git a/static/description/icon.svg b/web_widget_datepicker_options/static/description/icon.svg similarity index 100% rename from static/description/icon.svg rename to web_widget_datepicker_options/static/description/icon.svg diff --git a/web_widget_datepicker_options/static/src/js/datepicker.js b/web_widget_datepicker_options/static/src/js/datepicker.js new file mode 100644 index 00000000..ecd585ab --- /dev/null +++ b/web_widget_datepicker_options/static/src/js/datepicker.js @@ -0,0 +1,43 @@ +/* + OpenERP, Open Source Management Solution + This module copyright (C) 2015 Savoir-faire Linux + (). + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +odoo.define('web_widget_datepicker_options.datepicker', function(require) { + "use strict"; + var Widget = require('web.datepicker'); + + Widget.DateWidget.include({ + init: function() { + this._super.apply(this, arguments); + if(typeof this.__parentedParent !== 'undefined' && this.__parentedParent.field.type === 'date' && this.__parentedParent.nodeOptions){ + var datepicker = this.__parentedParent.nodeOptions.datepicker; + Object.assign(this.options, datepicker); + } + }, + }); + + Widget.DateTimeWidget.include({ + init: function() { + this._super.apply(this, arguments); + if(typeof this.__parentedParent !== 'undefined' && this.__parentedParent.field.type === 'date' && this.__parentedParent.nodeOptions){ + var datepicker = this.__parentedParent.nodeOptions.datepicker; + Object.assign(this.options, datepicker); + } + }, + }); +}); diff --git a/view/qweb.xml b/web_widget_datepicker_options/view/qweb.xml similarity index 100% rename from view/qweb.xml rename to web_widget_datepicker_options/view/qweb.xml