From 70aa3f96d4a0fc7344d28d9d7ececaf91e8f5a6a Mon Sep 17 00:00:00 2001 From: camilogs Date: Sun, 27 Aug 2023 20:52:42 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20Se=20agrega=20posible=20agendaci=C3=B3n?= =?UTF-8?q?=20de=20llamada=20en=20el=20flujo=20de=20crear=20una=20llamada,?= =?UTF-8?q?=20#58?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 1 + prospect_trace.py | 35 ++++++++++++++++++- prospect_trace.xml | 7 ++++ .../scenario_sale_opportunity_management.rst | 16 +++++++-- view/make_call_ask_form.xml | 7 ++++ view/make_call_start_form.xml | 4 ++- 6 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 view/make_call_ask_form.xml diff --git a/__init__.py b/__init__.py index 088e8f8..084d20e 100644 --- a/__init__.py +++ b/__init__.py @@ -21,6 +21,7 @@ def register(): prospect.AssignOperatorStart, prospect_trace.ScheduleCallStart, prospect_trace.MakeCallStart, + prospect_trace.MakeCallAsk, prospect.ReassignProspectByOperatorStart, prospect.ReassignProspectByProspectStart, module='sale_opportunity_management', type_='model') diff --git a/prospect_trace.py b/prospect_trace.py index 50c36fd..a28715e 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -121,6 +121,15 @@ class MakeCallStart(ModelView): description = fields.Text('Description') interest = fields.Selection( Interest.get_interest_levels(), 'Interest', required=True) + schedule_call = fields.Selection( + [('yes', 'Yes'), + ('no', 'No')], 'Schedule call?', required=True) + + +class MakeCallAsk(ModelView): + 'Posible agendación de llamada luego de hacer llamada actual' + __name__ = 'sale.prospect_trace.make_call.ask' + datetime = fields.DateTime('Date time') class MakeCall(Wizard): @@ -132,9 +141,16 @@ class MakeCall(Wizard): 'sale_opportunity_management.make_call_start_view_form', [ Button("Cancel", 'end', 'tryton-cancel'), Button("Make call", 'make_call', 'tryton-ok', default=True)]) - make_call = StateTransition() + ask = StateView( + 'sale.prospect_trace.make_call.ask', + 'sale_opportunity_management.make_call_ask_view_form', [ + Button("Cancel", 'end', 'tryton-cancel'), + Button( + "Schedule call", 'schedule_call', 'tryton-ok', default=True)]) + schedule_call = StateTransition() + def transition_make_call(self): prospect_trace = self.record @@ -167,4 +183,21 @@ class MakeCall(Wizard): prospect_trace.calls += (call,) prospect_trace.save() + if self.start.schedule_call == 'yes': + return 'ask' + + return 'end' + + def transition_schedule_call(self): + pool = Pool() + PendingCall = pool.get('sale.pending_call') + pending_call = PendingCall() + pending_call.date = self.ask.datetime + pending_call.save() + + prospect_trace = self.record + prospect_trace.pending_call = pending_call + prospect_trace.state = 'with_pending_calls' + prospect_trace.save() + return 'end' diff --git a/prospect_trace.xml b/prospect_trace.xml index 58cf1f4..f8be54a 100644 --- a/prospect_trace.xml +++ b/prospect_trace.xml @@ -84,5 +84,12 @@ this repository contains the full copyright notices and license terms. --> Make call + + + sale.prospect_trace.make_call.ask + form + make_call_ask_form + + \ No newline at end of file diff --git a/tests/scenario_sale_opportunity_management.rst b/tests/scenario_sale_opportunity_management.rst index 54814b8..01d423d 100644 --- a/tests/scenario_sale_opportunity_management.rst +++ b/tests/scenario_sale_opportunity_management.rst @@ -198,17 +198,27 @@ Crear llamadas a un seguimiento de prospecto:: >>> make_call = Wizard('sale.prospect_trace.make_call', [prospect_trace]) >>> make_call.form.description = 'First call to the prospect' >>> make_call.form.interest = '0' + >>> make_call.form.schedule_call = 'no' >>> make_call.execute('make_call') + >>> make_call.state + 'end' >>> make_call = Wizard('sale.prospect_trace.make_call', [prospect_trace]) >>> make_call.form.description = 'Second call to the prospect' >>> make_call.form.interest = '1' + >>> make_call.form.schedule_call = 'no' >>> make_call.execute('make_call') + >>> make_call.state + 'end' >>> make_call = Wizard('sale.prospect_trace.make_call', [prospect_trace]) >>> make_call.form.description = 'Third call to the prospect' >>> make_call.form.interest = '3' + >>> make_call.form.schedule_call = 'yes' >>> make_call.execute('make_call') + >>> make_call.form.datetime = datetime(2023, 8, 14, 15, 30, 30) + >>> make_call.execute('schedule_call') + Verificar estado final del seguimiento del prospecto y sus llamadas:: >>> prospect_trace.calls[0].call_result @@ -228,14 +238,16 @@ Verificar estado final del seguimiento del prospecto y sus llamadas:: >>> prospect_trace.calls [proteus.Model.get('sale.call')(1), proteus.Model.get('sale.call')(2), proteus.Model.get('sale.call')(3)] + >>> prospect_trace.pending_call.date + datetime.datetime(2023, 8, 14, 15, 30, 30) >>> prospect_trace.current_interest '3' >>> prospect_trace.state - 'open' + 'with_pending_calls' Programar una próxima llamada pendiente al seguimiento de prospecto:: >>> schedule = Wizard('sale.prospect_trace.schedule', [prospect_trace]) - >>> schedule.form.date_time = datetime(2023, 8, 14, 15, 30, 30) + >>> schedule.form.date_time = datetime(2`023, 8, 14, 15, 30, 30) >>> schedule.execute('schedule') >>> prospect_trace.pending_call.date diff --git a/view/make_call_ask_form.xml b/view/make_call_ask_form.xml new file mode 100644 index 0000000..fa0b854 --- /dev/null +++ b/view/make_call_ask_form.xml @@ -0,0 +1,7 @@ + + +
+