mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[9.0][MIG] web_widget_datepicker_options: Upgrade to v9 (#546)
* [9.0][MIG] web_widget_datepicker: Upgrade to v9 * Change headers to shorter version and openerp tags to odoo tags * Update Readme * Improvement
This commit is contained in:
committed by
Dave Lasley
parent
1310c58f00
commit
85e1728697
@@ -18,36 +18,43 @@
|
||||
*/
|
||||
/*global openerp, _, $ */
|
||||
|
||||
openerp.web_widget_datepicker_options = function (instance) {
|
||||
odoo.define('web_widget_datepicker_options', function (require) {
|
||||
|
||||
"use strict";
|
||||
|
||||
instance.web.form.FieldDatetime.include({
|
||||
initialize_content: function() {
|
||||
this._super();
|
||||
var core = require('web.core');
|
||||
|
||||
var DateTimeWidget = require('web.datepicker').DateTimeWidget;
|
||||
var DateWidget = require('web.datepicker').DateWidget;
|
||||
|
||||
DateTimeWidget.include({
|
||||
start: function(parent, options) {
|
||||
this._super.apply(this, arguments);
|
||||
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);
|
||||
});
|
||||
}
|
||||
if (this.__parentedParent.options.datepicker) {
|
||||
var options = this.__parentedParent.options.datepicker;
|
||||
$.each(options, function(value, key) {
|
||||
self.options[value] = key;
|
||||
self.picker[value] = key;
|
||||
self.picker.options[value] = key;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.form.FieldDate.include({
|
||||
initialize_content: function() {
|
||||
this._super();
|
||||
DateWidget.include({
|
||||
start: function(parent, options) {
|
||||
this._super.apply(this, arguments);
|
||||
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);
|
||||
});
|
||||
}
|
||||
if (this.__parentedParent.options.datepicker) {
|
||||
var options = this.__parentedParent.options.datepicker;
|
||||
$.each(options, function(value, key) {
|
||||
self.options[value] = key;
|
||||
self.picker[value] = key;
|
||||
self.picker.options[value] = key;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user