[FIX] web: use language week_start in datepickers

Before this rev., if the week_start param (the first day of week)
of the user language was changed, it wasn't reflected on datepickers
(however, it worked fine in the calendar view). This rev. makes this
work by updating the moment locale with the corresponding param.

Fixes #36450
Closes #36532

closes odoo/odoo#38472

X-original-commit: eeb518316f25d652bea3ec6d387db6ad93284fb2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
fw-bot
2019-10-11 09:15:43 +00:00
parent b33f98d81f
commit 3a2c69edbf
+19
View File
@@ -207,6 +207,8 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
}
return loaded.then(function () {
return self.load_js(file_list);
}).then(function () {
self._configureLocale();
});
},
load_translations: function () {
@@ -361,6 +363,23 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
location.reload();
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* Sets first day of week in current locale according to the user language.
*
* @private
*/
_configureLocale: function () {
moment.updateLocale(moment.locale(), {
week: {
dow: (_t.database.parameters.week_start || 0) % 7,
},
});
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------