chore: Se asigna estado por defecto en vez de en on_change_prospect
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
428767ab81
commit
51d81797d8
@ -5,7 +5,6 @@ from trytond.pool import Pool
|
|||||||
|
|
||||||
from .selections.call_types import CallTypes
|
from .selections.call_types import CallTypes
|
||||||
from .selections.interest import Interest
|
from .selections.interest import Interest
|
||||||
from .selections.prospect_trace_states import ProspectTraceStates
|
|
||||||
|
|
||||||
|
|
||||||
class ProspectTrace(ModelSQL, ModelView):
|
class ProspectTrace(ModelSQL, ModelView):
|
||||||
@ -24,8 +23,16 @@ class ProspectTrace(ModelSQL, ModelView):
|
|||||||
current_interest = fields.Selection(
|
current_interest = fields.Selection(
|
||||||
Interest.get_interest_levels(), 'Current interest')
|
Interest.get_interest_levels(), 'Current interest')
|
||||||
|
|
||||||
_states_selection = ProspectTraceStates.get_prospect_trace_states()
|
state = fields.Selection([
|
||||||
state = fields.Selection(_states_selection, 'State')
|
('unassigned', 'Unassigned'),
|
||||||
|
('open', 'Open'),
|
||||||
|
('with_pending_calls', 'With pending calls'),
|
||||||
|
('closed', 'Closed')
|
||||||
|
], 'State')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_state(cls):
|
||||||
|
return 'open'
|
||||||
|
|
||||||
@fields.depends('calls', 'current_interest')
|
@fields.depends('calls', 'current_interest')
|
||||||
def on_change_calls(self):
|
def on_change_calls(self):
|
||||||
@ -41,8 +48,7 @@ class ProspectTrace(ModelSQL, ModelView):
|
|||||||
@fields.depends('pending_calls', 'state')
|
@fields.depends('pending_calls', 'state')
|
||||||
def on_change_pending_calls(self):
|
def on_change_pending_calls(self):
|
||||||
if self.pending_calls:
|
if self.pending_calls:
|
||||||
with_pending_calls_state = self._states_selection[2][0]
|
self.state = 'with_pending_calls'
|
||||||
self.state = with_pending_calls_state
|
|
||||||
|
|
||||||
@fields.depends('prospect')
|
@fields.depends('prospect')
|
||||||
def on_change_prospect(self):
|
def on_change_prospect(self):
|
||||||
@ -55,9 +61,6 @@ class ProspectTrace(ModelSQL, ModelView):
|
|||||||
if mobile_contact:
|
if mobile_contact:
|
||||||
self.prospect_contact = mobile_contact
|
self.prospect_contact = mobile_contact
|
||||||
|
|
||||||
open_state = self._states_selection[1][0]
|
|
||||||
self.state = open_state
|
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
if self.prospect:
|
if self.prospect:
|
||||||
return '[' + str(self.id) + '] ' + self.prospect.name
|
return '[' + str(self.id) + '] ' + self.prospect.name
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
class ProspectTraceStates():
|
|
||||||
@staticmethod
|
|
||||||
def get_prospect_trace_states():
|
|
||||||
states = [
|
|
||||||
('unassigned', 'Unassigned'),
|
|
||||||
('open', 'Open'),
|
|
||||||
('with_pending_calls', 'With pending calls'),
|
|
||||||
('closed', 'Closed')
|
|
||||||
]
|
|
||||||
return states
|
|
Loading…
Reference in New Issue
Block a user