summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-11-10 08:59:25 +0000
committerSébastien Theys <seb@odoo.com>2020-11-30 15:21:27 +0000
commitd9aa362914945e6cb095b04fa94cfb3469abd907 (patch)
treed234604da02879d539155206949e112d437957c2 /addons/mail/static/src
parent24d52d4a8d0f475bb62b6653c08ce409e27e1d58 (diff)
[FIX] hr_holidays: bring back the out of office panel in threads
task-2277511 closes odoo/odoo#61586 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/core/translation.js5
-rw-r--r--addons/mail/static/src/models/locale/locale.js14
-rw-r--r--addons/mail/static/src/models/partner/partner.js14
3 files changed, 31 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/core/translation.js b/addons/mail/static/src/js/core/translation.js
index a8db8cebc57..faecafaff03 100644
--- a/addons/mail/static/src/js/core/translation.js
+++ b/addons/mail/static/src/js/core/translation.js
@@ -14,9 +14,10 @@ TranslationDataBase.include({
if (Component.env.messaging) {
// Update messaging locale whenever the translation bundle changes.
// In particular if messaging is created before the end of the
- // `load_translations` RPC, the default text direction has to be
- // updated by the received one.
+ // `load_translations` RPC, the default values have to be
+ // updated by the received ones.
Component.env.messaging.locale.update({
+ language: this.parameters.code,
textDirection: this.parameters.direction,
});
}
diff --git a/addons/mail/static/src/models/locale/locale.js b/addons/mail/static/src/models/locale/locale.js
index 4007dbc796c..50167f07c2f 100644
--- a/addons/mail/static/src/models/locale/locale.js
+++ b/addons/mail/static/src/models/locale/locale.js
@@ -16,6 +16,14 @@ function factory(dependencies) {
* @private
* @returns {string}
*/
+ _computeLanguage() {
+ return this.env._t.database.parameters.code;
+ }
+
+ /**
+ * @private
+ * @returns {string}
+ */
_computeTextDirection() {
return this.env._t.database.parameters.direction;
}
@@ -23,6 +31,12 @@ function factory(dependencies) {
}
Locale.fields = {
+ /**
+ * Language used by interface, formatted like {language ISO 2}_{country ISO 2} (eg: fr_FR).
+ */
+ language: attr({
+ compute: '_computeLanguage',
+ }),
textDirection: attr({
compute: '_computeTextDirection',
}),
diff --git a/addons/mail/static/src/models/partner/partner.js b/addons/mail/static/src/models/partner/partner.js
index 95d2e2794ac..3de505426ec 100644
--- a/addons/mail/static/src/models/partner/partner.js
+++ b/addons/mail/static/src/models/partner/partner.js
@@ -259,6 +259,14 @@ function factory(dependencies) {
/**
* @private
+ * @returns {mail.messaging}
+ */
+ _computeMessaging() {
+ return [['link', this.env.messaging]];
+ }
+
+ /**
+ * @private
* @returns {string|undefined}
*/
_computeNameOrDisplayName() {
@@ -308,6 +316,12 @@ function factory(dependencies) {
messagesAsAuthor: one2many('mail.message', {
inverse: 'author',
}),
+ /**
+ * Serves as compute dependency.
+ */
+ messaging: many2one('mail.messaging', {
+ compute: '_computeMessaging',
+ }),
model: attr({
default: 'res.partner',
}),