[FIX] mail: display default name for followers for "other address" partner

Display the default name (the one displayed in the kanban view) for followers replacing
the False value for "other address" partners, this way the user won't get
confused, furthermore, this fix won't require the name to be mandatory for this
type of contacts.

Task-2514244

closes odoo/odoo#70445

X-original-commit: 338b84bd9d2d675af30ab19c6bb262d2f68546b9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
nounoubensebia
2021-05-06 08:00:36 +00:00
parent dfb8c1b9e7
commit fa0738dd7e
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -142,6 +142,7 @@ class MailController(http.Controller):
'id': follower.id,
'partner_id': follower.partner_id.id,
'name': follower.name,
'display_name': follower.display_name,
'email': follower.email,
'is_active': follower.is_active,
# When editing the followers, the "pencil" icon that leads to the edition of subtypes
@@ -6,7 +6,7 @@
<t t-if="follower">
<a class="o_Follower_details" t-att-class="{ 'o-inactive': !follower.isActive }" href="#" t-on-click="_onClickDetails">
<img class="o_Follower_avatar" t-att-src="follower.partner.avatarUrl" alt="Avatar"/>
<span class="o_Follower_name" t-esc="follower.name"/>
<span class="o_Follower_name" t-esc="follower.name or follower.displayName"/>
</a>
<t t-if="follower.isEditable">
<button class="btn btn-icon o_Follower_button o_Follower_editButton" title="Edit subscription" t-on-click="_onClickEdit">
@@ -33,6 +33,7 @@ function factory(dependencies) {
data2.partner = unlinkAll();
} else {
const partnerData = {
display_name: data.display_name,
email: data.email,
id: data.partner_id,
name: data.name,
@@ -158,6 +159,9 @@ function factory(dependencies) {
}
Follower.fields = {
displayName: attr({
related: 'partner.display_name'
}),
followedThread: many2one('mail.thread', {
inverse: 'followers',
}),