From b1f7e56f7938649c540cab8c2feec3c6407ae47d Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Fri, 2 Jun 2023 10:30:20 +0200 Subject: [PATCH] [IMP] base: Remove private res.partner type - Improve performances, as the ir.rule restricting private partners visibility is also applied on res.users by inheritance, on each prefetch. - Solve the issue of partners set as followers on records (eg: application form) and then made private, making them impossible to contact via the chatter. - Solve the multiple access issues when trying to access the bank account, or the private address for non HR people like the accountants forcing the usage of sudo in the business code. TaskID: 3101400 --- addons/account/security/account_security.xml | 2 +- addons/account/views/account_move_views.xml | 2 +- addons/account/wizard/account_move_send.py | 1 - addons/calendar/views/calendar_views.xml | 2 - addons/digest/tests/common.py | 2 +- addons/google_calendar/models/google_sync.py | 4 +- .../tests/test_sync_google2odoo.py | 8 ++-- addons/hr/security/hr_security.xml | 2 +- addons/hr_recruitment/models/hr_applicant.py | 3 -- .../wizard/applicant_send_mail.py | 1 - .../models/hr_applicant.py | 1 - .../hr_recruitment_survey_security.xml | 2 +- addons/mail/models/discuss/res_partner.py | 1 - addons/mail/models/mail_followers.py | 2 +- addons/mail/models/mail_thread.py | 2 +- addons/mail/models/res_partner.py | 1 - addons/mail/tests/test_mail_composer.py | 30 +++++++-------- addons/mail/views/mail_mail_views.xml | 2 +- addons/mail/wizard/mail_compose_message.py | 7 ---- addons/mail/wizard/mail_wizard_invite.py | 2 +- addons/sale/models/sale_order.py | 2 +- addons/test_mail/tests/test_mail_followers.py | 10 +++-- addons/test_mail/tests/test_mail_gateway.py | 37 ++++--------------- odoo/addons/base/models/res_partner.py | 1 - odoo/addons/base/populate/res_partner.py | 2 +- odoo/addons/base/security/base_security.xml | 36 ------------------ odoo/addons/base/tests/test_ir_actions.py | 8 ---- odoo/addons/base/views/res_partner_views.xml | 3 -- .../test_new_api/models/test_new_api.py | 17 --------- .../test_new_api/security/ir.model.access.csv | 1 - .../test_new_api/tests/test_company_checks.py | 19 ---------- 31 files changed, 45 insertions(+), 168 deletions(-) diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index e20a581c784..0ea90c4dbe6 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -59,7 +59,7 @@ Billing Administrator - + diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index a1f80508f2e..584c264f6eb 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -782,7 +782,7 @@ context="{ 'res_partner_search_mode': (context.get('default_move_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('default_move_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False, 'show_address': 1, 'default_is_company': True, 'show_vat': True}" - domain="[('type', '!=', 'private'), ('company_id', 'in', (False, company_id))]" + domain="[('company_id', 'in', (False, company_id))]" options='{"always_reload": True, "no_quick_create": True}' attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/> diff --git a/addons/account/wizard/account_move_send.py b/addons/account/wizard/account_move_send.py index 4f3179f1f5a..71e44767803 100644 --- a/addons/account/wizard/account_move_send.py +++ b/addons/account/wizard/account_move_send.py @@ -55,7 +55,6 @@ class AccountMoveSend(models.Model): mail_partner_ids = fields.Many2many( comodel_name='res.partner', string="Recipients", - domain=[('type', '!=', 'private')], compute='_compute_mail_partner_ids', store=True, readonly=False, diff --git a/addons/calendar/views/calendar_views.xml b/addons/calendar/views/calendar_views.xml index 3e92d8418b2..7ed77845288 100644 --- a/addons/calendar/views/calendar_views.xml +++ b/addons/calendar/views/calendar_views.xml @@ -192,7 +192,6 @@ @@ -321,7 +320,6 @@