From 428767ab8163f4af65d97c7d904b2e3e9dd295eb Mon Sep 17 00:00:00 2001 From: camilogs Date: Sat, 12 Aug 2023 12:54:43 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20Se=20crea=20reduce=20c=C3=B3digo=20dup?= =?UTF-8?q?licado=20creando=20campo=20=5Fstates=5Fselection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prospect_trace.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/prospect_trace.py b/prospect_trace.py index 7f11833..3bc3542 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -24,8 +24,8 @@ class ProspectTrace(ModelSQL, ModelView): current_interest = fields.Selection( Interest.get_interest_levels(), 'Current interest') - state = fields.Selection( - ProspectTraceStates.get_prospect_trace_states(), 'State') + _states_selection = ProspectTraceStates.get_prospect_trace_states() + state = fields.Selection(_states_selection, 'State') @fields.depends('calls', 'current_interest') def on_change_calls(self): @@ -40,10 +40,9 @@ class ProspectTrace(ModelSQL, ModelView): @fields.depends('pending_calls', 'state') def on_change_pending_calls(self): - pc_states = ProspectTraceStates.get_prospect_trace_states() if self.pending_calls: - with_pending_calls = pc_states[2][0] - self.state = with_pending_calls + with_pending_calls_state = self._states_selection[2][0] + self.state = with_pending_calls_state @fields.depends('prospect') def on_change_prospect(self): @@ -56,9 +55,8 @@ class ProspectTrace(ModelSQL, ModelView): if mobile_contact: self.prospect_contact = mobile_contact - pc_states = ProspectTraceStates.get_prospect_trace_states() - open = pc_states[1][0] - self.state = open + open_state = self._states_selection[1][0] + self.state = open_state def get_rec_name(self, name): if self.prospect: