From fe8a49d81f31c92b5ac144bb7f89c0f088446e32 Mon Sep 17 00:00:00 2001 From: jbw Date: Fri, 15 Jan 2021 14:46:33 +0000 Subject: [PATCH] [IMP] mail: change chatter output for tracked boolean fields When a tracked boolean value is changed, old and new values are displaye in a chatter message. Boolean values were not captialised ("true" & "false"). They are now ("True" & "False"). And they now also can be translated. --- addons/mail/static/src/components/message/message.js | 7 +++++++ addons/mail/static/src/components/message/message_tests.js | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js index aaec2088063..d7800cbfc56 100644 --- a/addons/mail/static/src/components/message/message.js +++ b/addons/mail/static/src/components/message/message.js @@ -295,6 +295,13 @@ class Message extends Component { value.new_value = moment(value.new_value).local().format('LL'); } + } else if (value.field_type === 'boolean') { + if (value.old_value !== undefined){ + value.old_value = value.old_value ? this.env._t("True") : this.env._t("False"); + } + if (value.new_value !== undefined){ + value.new_value = value.new_value ? this.env._t("True") : this.env._t("False"); + } } return value; }); diff --git a/addons/mail/static/src/components/message/message_tests.js b/addons/mail/static/src/components/message/message_tests.js index 8ef1b6d5ab7..73403d71eee 100644 --- a/addons/mail/static/src/components/message/message_tests.js +++ b/addons/mail/static/src/components/message/message_tests.js @@ -1141,7 +1141,7 @@ QUnit.test('rendering of tracked field with change of value from true to false', await this.createMessageComponent(message); assert.strictEqual( document.querySelector('.o_Message_trackingValue').textContent, - "Is Ready:truefalse", + "Is Ready:TrueFalse", "should display the correct content of tracked field with change of value from true to false (Is Ready: true -> false)" ); }); @@ -1163,7 +1163,7 @@ QUnit.test('rendering of tracked field with change of value from false to true', await this.createMessageComponent(message); assert.strictEqual( document.querySelector('.o_Message_trackingValue').textContent, - "Is Ready:falsetrue", + "Is Ready:FalseTrue", "should display the correct content of tracked field with change of value from false to true (Is Ready: false -> true)" ); });