From a34e324006ae85c41b83745d5248ee6601d7a305 Mon Sep 17 00:00:00 2001 From: camilogs Date: Tue, 8 Aug 2023 18:22:08 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20Se=20cambia=20ciclo=20for=20por=20m?= =?UTF-8?q?=C3=A9todo=20.search=20en=20la=20b=C3=BAsqueda=20del=20m=C3=B3v?= =?UTF-8?q?il=20del=20contacto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prospect_trace.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/prospect_trace.py b/prospect_trace.py index 6d120e2..d488f38 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -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