[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:
Kelly Lougheed
2017-03-07 13:27:21 -08:00
committed by Dave Lasley
parent 1310c58f00
commit 85e1728697
6 changed files with 78 additions and 81 deletions

View File

@@ -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;
});
}
}
},
});
};
});