feat: Se agrega posible agendación de llamada en el flujo de crear una llamada, #58
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
27d4ce8a77
commit
70aa3f96d4
@ -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')
|
||||
|
@ -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'
|
||||
|
@ -84,5 +84,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="string">Make call</field>
|
||||
<field name="model" search="[('model', '=', 'sale.prospect_trace')]"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="make_call_ask_view_form">
|
||||
<field name="model">sale.prospect_trace.make_call.ask</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">make_call_ask_form</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
@ -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
|
||||
|
7
view/make_call_ask_form.xml
Normal file
7
view/make_call_ask_form.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="datetime"/>
|
||||
<field name="datetime"/>
|
||||
</form>
|
@ -3,8 +3,10 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="description"/>
|
||||
<field name="description"/>
|
||||
<field name="description" colspan="6"/>
|
||||
<newline/>
|
||||
<label name="interest"/>
|
||||
<field name="interest"/>
|
||||
<label name="schedule_call"/>
|
||||
<field name="schedule_call"/>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user