Merge branch 'develop' into 'main'
fix: Убраны зависимости от iap See merge request productteam/talismanplatform/modules/odoo_17.0.1/crm!2
This commit is contained in:
commit
a3b449a288
|
@ -11,7 +11,6 @@ from markupsafe import Markup
|
|||
from psycopg2 import sql
|
||||
|
||||
from odoo import api, fields, models, tools, SUPERUSER_ID
|
||||
from odoo.addons.iap.tools import iap_tools
|
||||
from odoo.addons.mail.tools import mail_validation
|
||||
from odoo.addons.phone_validation.tools import phone_validation
|
||||
from odoo.exceptions import UserError, AccessError
|
||||
|
@ -189,13 +188,6 @@ class Lead(models.Model):
|
|||
'Email', tracking=40, index='trigram',
|
||||
compute='_compute_email_from', inverse='_inverse_email_from', readonly=False, store=True)
|
||||
email_normalized = fields.Char(index='trigram') # inherited via mail.thread.blacklist
|
||||
email_domain_criterion = fields.Char(
|
||||
string='Email Domain Criterion',
|
||||
compute="_compute_email_domain_criterion",
|
||||
index='btree_not_null', # used for exact match, void value do not matter
|
||||
store=True,
|
||||
unaccent=False, # normalized, exact matching
|
||||
)
|
||||
phone = fields.Char(
|
||||
'Phone', tracking=50,
|
||||
compute='_compute_phone', inverse='_inverse_phone', readonly=False, store=True)
|
||||
|
@ -460,14 +452,6 @@ class Lead(models.Model):
|
|||
if lead._get_partner_email_update():
|
||||
lead.partner_id.email = lead.email_from
|
||||
|
||||
@api.depends('email_normalized')
|
||||
def _compute_email_domain_criterion(self):
|
||||
self.email_domain_criterion = False
|
||||
for lead in self.filtered('email_normalized'):
|
||||
lead.email_domain_criterion = iap_tools.mail_prepare_for_domain_search(
|
||||
lead.email_normalized
|
||||
)
|
||||
|
||||
@api.depends('partner_id.phone')
|
||||
def _compute_phone(self):
|
||||
for lead in self:
|
||||
|
@ -565,7 +549,7 @@ class Lead(models.Model):
|
|||
lead.meeting_display_date = lead_meeting_info['last_meeting_date']
|
||||
lead.meeting_display_label = _('Last Meeting')
|
||||
|
||||
@api.depends('email_domain_criterion', 'email_normalized', 'partner_id',
|
||||
@api.depends('email_normalized', 'partner_id',
|
||||
'phone_sanitized')
|
||||
def _compute_potential_lead_duplicates(self):
|
||||
""" Override potential lead duplicates computation to be more efficient
|
||||
|
@ -601,11 +585,6 @@ class Lead(models.Model):
|
|||
|
||||
duplicate_lead_ids = self.env['crm.lead']
|
||||
|
||||
# check the "company" email domain duplicates
|
||||
if lead.email_domain_criterion:
|
||||
duplicate_lead_ids |= return_if_relevant('crm.lead', common_lead_domain + [
|
||||
('email_domain_criterion', '=', lead.email_domain_criterion)
|
||||
])
|
||||
# check for "same commercial entity" duplicates
|
||||
if lead.partner_id and lead.partner_id.commercial_partner_id:
|
||||
duplicate_lead_ids |= lead.with_context(active_test=False).search(common_lead_domain + [
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.addons.crm.tests.common import TestCrmCommon
|
||||
from odoo.addons.iap.tools import iap_tools
|
||||
from odoo.tests.common import tagged, users
|
||||
|
||||
|
||||
|
@ -209,23 +208,4 @@ class TestCRMLead(TestCrmCommon):
|
|||
'email_from': test_email,
|
||||
'name': test_email,
|
||||
})
|
||||
self.assertEqual(lead.email_domain_criterion, f'@{provider}',)
|
||||
|
||||
@users('user_sales_leads')
|
||||
def test_iap_tools(self):
|
||||
""" Test iap tools specifically """
|
||||
for test_email, provider in self.emails_provider_generic:
|
||||
with self.subTest(test_email=test_email, provider=provider):
|
||||
self.assertEqual(
|
||||
iap_tools.mail_prepare_for_domain_search(test_email),
|
||||
test_email,
|
||||
'As provider is a generic one, complete email should be returned for a company-based mail search'
|
||||
)
|
||||
|
||||
for test_email, provider in self.emails_provider_company:
|
||||
with self.subTest(test_email=test_email, provider=provider):
|
||||
self.assertEqual(
|
||||
iap_tools.mail_prepare_for_domain_search(test_email),
|
||||
f'@{provider}',
|
||||
'As provider is a company one, only the domain part should be returned for a company-based mail search'
|
||||
)
|
||||
self.assertEqual(lead.email_domain_criterion, f'@{provider}',)
|
Loading…
Reference in New Issue
Block a user