chore: Se cambia ciclo for por método .search en la búsqueda del móvil del contacto
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Camilo Gonzalez 2023-08-08 18:22:08 -05:00
parent e72de25e3a
commit a34e324006

View File

@ -1,6 +1,7 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import Pool
from .selections.call_types import CallTypes
from .selections.interest import Interest
@ -64,6 +65,12 @@ class ProspectTrace(ModelSQL, ModelView):
return self.calls[-1].interest
def _get_prospect_mobile_contact(self):
for contact_method in self.prospect.contact_methods:
if contact_method.contact_type == 'mobile':
return contact_method
pool = Pool()
ContactMethod = pool.get('prospect.contact_method')
contact_mobile, = ContactMethod.search(
[('prospect', '=', self.prospect.id),
('contact_type', '=', 'mobile')],
limit=1)
return contact_mobile