From 4cec1e12d86c49678f326842c062a0a887770f28 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Dufays
Date: Tue, 21 Feb 2023 14:00:20 +0000
Subject: [PATCH] [REF] various: apply main attachment mixin on models that use
the feature
Add mail.thread.main.attachment in the inheritance chain of all models that
use the main attachment feature.
Note that we remove the main attachment from crm_case_15 of the demo data as
crm_lead doesn't use that feature.
Task-2648976
Part-of: odoo/odoo#110734
---
addons/account/models/account_move.py | 2 +-
addons/account/models/account_payment.py | 2 +-
addons/crm/data/crm_lead_demo.xml | 4 ----
addons/hr/models/hr_employee.py | 2 +-
addons/hr_expense/models/hr_expense.py | 4 ++--
addons/hr_holidays/models/hr_leave.py | 2 +-
addons/hr_recruitment/models/hr_applicant.py | 2 +-
7 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index db90f984acd..494ffe94c79 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -49,7 +49,7 @@ EMPTY = object()
class AccountMove(models.Model):
_name = "account.move"
- _inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin', 'sequence.mixin']
+ _inherit = ['portal.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin', 'sequence.mixin']
_description = "Journal Entry"
_order = 'date desc, name desc, id desc'
_mail_post_access = 'read'
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index 20eb353866c..c8634590845 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -7,7 +7,7 @@ from odoo.tools.misc import format_date, formatLang
class AccountPayment(models.Model):
_name = "account.payment"
_inherits = {'account.move': 'move_id'}
- _inherit = ['mail.thread', 'mail.activity.mixin']
+ _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin']
_description = "Payments"
_order = "date desc, name desc"
_check_company_auto = True
diff --git a/addons/crm/data/crm_lead_demo.xml b/addons/crm/data/crm_lead_demo.xml
index 8cbc3c03a4a..31385b1349d 100644
--- a/addons/crm/data/crm_lead_demo.xml
+++ b/addons/crm/data/crm_lead_demo.xml
@@ -444,10 +444,6 @@ Andrew
]]>
-
-
-
-
Re: Plan to buy RedHat servers
crm.lead
diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py
index a851e18d937..81c807f801a 100644
--- a/addons/hr/models/hr_employee.py
+++ b/addons/hr/models/hr_employee.py
@@ -26,7 +26,7 @@ class HrEmployeePrivate(models.Model):
_name = "hr.employee"
_description = "Employee"
_order = 'name'
- _inherit = ['hr.employee.base', 'mail.thread', 'mail.activity.mixin', 'resource.mixin', 'avatar.mixin']
+ _inherit = ['hr.employee.base', 'mail.thread.main.attachment', 'mail.activity.mixin', 'resource.mixin', 'avatar.mixin']
_mail_post_access = 'read'
# resource and user
diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index 2910a4db5cc..bdb4654c6a5 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -15,7 +15,7 @@ from odoo.tools import email_split, float_repr, float_compare, is_html_empty
class HrExpense(models.Model):
_name = "hr.expense"
- _inherit = ['mail.thread', 'mail.activity.mixin', 'analytic.mixin']
+ _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'analytic.mixin']
_description = "Expense"
_order = "date desc, id desc"
_check_company_auto = True
@@ -784,7 +784,7 @@ class HrExpenseSheet(models.Model):
=================================================================================
"""
_name = "hr.expense.sheet"
- _inherit = ['mail.thread', 'mail.activity.mixin']
+ _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin']
_description = "Expense Report"
_order = "accounting_date desc, id desc"
_check_company_auto = True
diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py
index a03bc41a9f7..9612ed30749 100644
--- a/addons/hr_holidays/models/hr_leave.py
+++ b/addons/hr_holidays/models/hr_leave.py
@@ -72,7 +72,7 @@ class HolidaysRequest(models.Model):
_name = "hr.leave"
_description = "Time Off"
_order = "date_from desc"
- _inherit = ['mail.thread', 'mail.activity.mixin']
+ _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin']
_mail_post_access = 'read'
@api.model
diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py
index 0a091639ba7..e9730b74a46 100644
--- a/addons/hr_recruitment/models/hr_applicant.py
+++ b/addons/hr_recruitment/models/hr_applicant.py
@@ -22,7 +22,7 @@ class Applicant(models.Model):
_name = "hr.applicant"
_description = "Applicant"
_order = "priority desc, id desc"
- _inherit = ['mail.thread.cc', 'mail.activity.mixin', 'utm.mixin']
+ _inherit = ['mail.thread.cc', 'mail.thread.main.attachment', 'mail.activity.mixin', 'utm.mixin']
_mailing_enabled = True
_primary_email = 'email_from'