From b63f0ffd8541403d41a1d8ca034070b38630bdc1 Mon Sep 17 00:00:00 2001 From: camilogs Date: Fri, 11 Aug 2023 17:22:49 -0500 Subject: [PATCH] chore: Se usa if guard para romper flujo en caso de nulo --- prospect_trace.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prospect_trace.py b/prospect_trace.py index d488f38..8be1d47 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -41,12 +41,13 @@ class ProspectTrace(ModelSQL, ModelView): @fields.depends('prospect') def on_change_prospect(self): - if self.prospect: - self.prospect_city = self.prospect.city + if not self.prospect: + return - mobile_contact = self._get_prospect_mobile_contact() - if mobile_contact: - self.prospect_contact = mobile_contact + self.prospect_city = self.prospect.city + mobile_contact = self._get_prospect_mobile_contact() + if mobile_contact: + self.prospect_contact = mobile_contact def get_rec_name(self, name): if self.prospect: