mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_widget_datepicker_options: Apply fixes after migration to v11
This applies some changes to the module after migration, to conform new guidelines and conventions for version 11.0. In addition, this applies the following fixes: - The widged didn't work when the field was a `datetime` due to a typo in a JS conditional - Replaced `Object.assign()` -> `_.assign()` to improve browser-compatibility
This commit is contained in:
@@ -1,20 +1,5 @@
|
||||
/*
|
||||
OpenERP, Open Source Management Solution
|
||||
This module copyright (C) 2015 Savoir-faire Linux
|
||||
(<http://www.savoirfairelinux.com>).
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
*/
|
||||
|
||||
odoo.define('web_widget_datepicker_options.datepicker', function(require) {
|
||||
@@ -24,9 +9,12 @@ odoo.define('web_widget_datepicker_options.datepicker', function(require) {
|
||||
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);
|
||||
var parent = this.getParent();
|
||||
if(typeof parent !== 'undefined'
|
||||
&& parent.field.type === 'date'
|
||||
&& parent.nodeOptions){
|
||||
var datepicker = parent.nodeOptions.datepicker;
|
||||
_.assign(this.options, datepicker);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -34,9 +22,12 @@ odoo.define('web_widget_datepicker_options.datepicker', function(require) {
|
||||
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);
|
||||
var parent = this.getParent();
|
||||
if(typeof parent !== 'undefined'
|
||||
&& parent.field.type === 'datetime'
|
||||
&& parent.nodeOptions){
|
||||
var datepicker = parent.nodeOptions.datepicker;
|
||||
_.assign(this.options, datepicker);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user