Compare commits
1 Commits
pantallaDe
...
Reportes
| Author | SHA1 | Date | |
|---|---|---|---|
| fa850b69ef |
@@ -4,6 +4,7 @@ from . import prospect_trace
|
||||
from . import call
|
||||
from . import pending_call
|
||||
from . import user
|
||||
from . import print_report_by_operator
|
||||
from .locations import city
|
||||
from .locations import department
|
||||
|
||||
@@ -28,7 +29,7 @@ def register():
|
||||
prospect_trace.MakeCallAskTask,
|
||||
prospect.ReassignProspectByOperatorStart,
|
||||
prospect.ReassignProspectByProspectStart,
|
||||
call.PendingTask_ContactMethod,
|
||||
print_report_by_operator.PrintReportByOperatorStart,
|
||||
module='sale_opportunity_management', type_='model')
|
||||
Pool.register(
|
||||
prospect_trace.ScheduleCall,
|
||||
@@ -36,6 +37,7 @@ def register():
|
||||
prospect_trace.MakeCall,
|
||||
prospect.ReassignProspectByOperator,
|
||||
prospect.ReasignProspectByProspect,
|
||||
print_report_by_operator.PrintReportByOperator,
|
||||
module='sale_opportunity_management', type_='wizard')
|
||||
Pool.register(
|
||||
module='sale_opportunity_management', type_='report')
|
||||
|
||||
17
call.py
17
call.py
@@ -67,18 +67,12 @@ class PendingTask(ModelSQL, ModelView):
|
||||
'sale.prospect_trace', 'Prospect trace',
|
||||
required=True, readonly=True)
|
||||
|
||||
contacts = fields.Many2Many(
|
||||
'sale.pendingtask_contactmethod',
|
||||
'pending_task_id', 'contact_method_id',
|
||||
'Contact Methods')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(PendingTask, cls).__setup__()
|
||||
cls._buttons.update({
|
||||
'close_task': {
|
||||
'invisible': Eval('state') == 'done',
|
||||
'depends': ['state'],
|
||||
'invisible': Eval('state') == 'done'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -92,12 +86,3 @@ class PendingTask(ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def default_state(cls):
|
||||
return 'pending'
|
||||
|
||||
|
||||
class PendingTask_ContactMethod(ModelSQL):
|
||||
'Relacion muchos a muchos entre tareas pendientes y mecanismos de contacto'
|
||||
__name__ = "sale.pendingtask_contactmethod"
|
||||
|
||||
pending_task_id = fields.Many2One('sale.pending_task', 'Pending task id')
|
||||
contact_method_id = fields.Many2One(
|
||||
'prospect.contact_method', 'Contact method id')
|
||||
|
||||
@@ -246,10 +246,6 @@ msgctxt "field:sale.pending_task,prospect_trace:"
|
||||
msgid "Prospect trace"
|
||||
msgstr "Seguimiento de prospecto"
|
||||
|
||||
msgctxt "field:sale.pending_task,contacts:"
|
||||
msgid "Contact Methods"
|
||||
msgstr "Métodos de Contacto"
|
||||
|
||||
msgctxt "field:sale.prospect_trace.make_call.start,schedule_task:"
|
||||
msgid "Schedule task?"
|
||||
msgstr "¿Agendar tarea?"
|
||||
|
||||
24
print_report_by_operator.py
Normal file
24
print_report_by_operator.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
# from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.wizard import Wizard, StateView, Button # , StateReport
|
||||
from trytond.model import fields, ModelView
|
||||
|
||||
|
||||
class PrintReportByOperatorStart(ModelView):
|
||||
'Vista inicial de reporte por operario'
|
||||
__name__ = 'sale.print_report_by_operator.start'
|
||||
|
||||
start_date = fields.Date('Start date')
|
||||
end_date = fields.Date('End date')
|
||||
|
||||
|
||||
class PrintReportByOperator(Wizard):
|
||||
'Generar reporte por operario'
|
||||
__name__ = 'sale.print_report_by_operator'
|
||||
|
||||
start = StateView(
|
||||
'sale.print_report_by_operator.start',
|
||||
'sale_opportunity_management.print_report_by_operator_start_view_form',
|
||||
[Button("Cancel", "end", "tryton-cancel"),
|
||||
Button("Print Report", "print_report", "tryton-ok", default=True)])
|
||||
16
print_report_by_operator.xml
Normal file
16
print_report_by_operator.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<!-- <?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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.action.wizard" id="print_report_by_operator_wizard">
|
||||
<field name="name">Print report by operator</field>
|
||||
<field name="wiz_name">sale.print_report_by_operator</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="print_report_by_operator_start_view_form">
|
||||
<field name="model">sale.print_report_by_operator.start</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">print_report_by_operator_start_form</field>
|
||||
</record>
|
||||
<data>
|
||||
<tryton/> -->
|
||||
19
prospect.py
19
prospect.py
@@ -51,11 +51,6 @@ class Prospect(ModelSQL, ModelView, DeactivableMixin):
|
||||
def default_state(cls):
|
||||
return 'unassigned'
|
||||
|
||||
@fields.depends('prospect_trace', 'contact_methods')
|
||||
def on_change_contact_methods(self):
|
||||
for contact in self.contact_methods:
|
||||
contact.update_collaborators(changed_from='prospect')
|
||||
|
||||
@fields.depends('city', 'department')
|
||||
def on_change_city(self):
|
||||
if self.city:
|
||||
@@ -80,24 +75,10 @@ class ContactMethod(ModelSQL, ModelView):
|
||||
prospect_trace = fields.Many2One(
|
||||
'sale.prospect_trace', 'Prospect Trace', required=False)
|
||||
|
||||
tasks = fields.Many2Many(
|
||||
'sale.pendingtask_contactmethod',
|
||||
'contact_method_id', 'pending_task_id',
|
||||
'Tasks')
|
||||
|
||||
@classmethod
|
||||
def default_contact_type(cls):
|
||||
return 'mobile'
|
||||
|
||||
def update_collaborators(self, changed_from):
|
||||
if (changed_from == 'prospect'):
|
||||
self.prospect_trace = self.prospect.prospect_trace
|
||||
if (self.prospect_trace):
|
||||
self.tasks = self.prospect.prospect_trace.tasks
|
||||
if (changed_from == 'prospect_trace'):
|
||||
self.prospect = self.prospect_trace.prospect
|
||||
self.tasks = self.prospect_trace.tasks
|
||||
|
||||
def get_rec_name(self, name):
|
||||
fields = [self.name, self.job, self.value]
|
||||
contact_rec_name = ''
|
||||
|
||||
@@ -36,9 +36,6 @@ class ProspectTrace(ModelSQL, ModelView):
|
||||
'sale.call', 'prospect_trace', 'Calls', states=_states)
|
||||
pending_call = fields.Many2One(
|
||||
'sale.pending_call', 'Pending call', states=_states)
|
||||
tasks = fields.One2Many(
|
||||
'sale.pending_task', 'prospect_trace',
|
||||
'Pending Tasks', states=_states)
|
||||
|
||||
current_interest = fields.Selection(
|
||||
Interest.get_interest_levels(), 'Current interest',
|
||||
@@ -55,7 +52,7 @@ class ProspectTrace(ModelSQL, ModelView):
|
||||
@fields.depends('prospect_contacts', 'prospect')
|
||||
def on_change_prospect_contacts(self):
|
||||
for contact in self.prospect_contacts:
|
||||
contact.update_collaborators(changed_from='prospect_trace')
|
||||
contact.prospect = self.prospect
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
@@ -266,7 +263,6 @@ class MakeCall(Wizard):
|
||||
task = Task()
|
||||
task.description = description
|
||||
task.prospect_trace = prospect_trace
|
||||
task.contacts = prospect_trace.prospect_contacts
|
||||
task.save()
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -287,42 +287,16 @@ Hacer llamada y programar tarea::
|
||||
>>> make_call.execute('schedule_task')
|
||||
|
||||
>>> Task = Model.get('sale.pending_task')
|
||||
>>> task1, = Task.find([('description', '=', 'I have to send a mail to prospect offering him this services...')])
|
||||
|
||||
>>> task1
|
||||
>>> task, = Task.find([('description', '=', 'I have to send a mail to prospect offering him this services...')])
|
||||
>>> task
|
||||
proteus.Model.get('sale.pending_task')(1)
|
||||
>>> task1.state
|
||||
|
||||
>>> task.state
|
||||
'pending'
|
||||
|
||||
>>> task1.click('close_task')
|
||||
|
||||
>>> task1.state
|
||||
>>> task.click('close_task')
|
||||
>>> task.state
|
||||
'done'
|
||||
>>> task1.contacts[0].value
|
||||
'12345678910'
|
||||
|
||||
Programar segunda tarea al mismo seguimiento::
|
||||
>>> make_call = Wizard('sale.prospect_trace.make_call', [prospect_trace])
|
||||
>>> make_call.form.description = 'Prospect told me to send him an SMS'
|
||||
>>> make_call.form.interest = '3'
|
||||
>>> make_call.form.schedule_call = 'no'
|
||||
>>> make_call.form.schedule_task = 'yes'
|
||||
>>> make_call.execute('make_call')
|
||||
>>> make_call.form.task_description = 'I have to send a SMS to prospect offering him this services...'
|
||||
>>> make_call.execute('schedule_task')
|
||||
|
||||
>>> task1.save()
|
||||
>>> Task = Model.get('sale.pending_task')
|
||||
>>> task2, = Task.find([('description', '=', 'I have to send a SMS to prospect offering him this services...')])
|
||||
>>> task2
|
||||
proteus.Model.get('sale.pending_task')(2)
|
||||
|
||||
>>> task2.state
|
||||
'pending'
|
||||
>>> task2.contacts[0].value
|
||||
'12345678910'
|
||||
>>> task1.contacts[0].value
|
||||
'12345678910'
|
||||
|
||||
Hacer llamada y cerrar venta (Seguimiento de prospecto)::
|
||||
>>> make_call = Wizard('sale.prospect_trace.make_call', [prospect_trace])
|
||||
@@ -373,6 +347,7 @@ Reasignar prospectos por prospecto::
|
||||
>>> reassign_by_prospect.form.prospect = prospect1
|
||||
>>> reassign_by_prospect.form.new_operator = user
|
||||
>>> reassign_by_prospect.execute('reassign_by_prospect')
|
||||
|
||||
|
||||
>>> prospect1.reload()
|
||||
>>> prospect1.assigned_operator.name
|
||||
@@ -389,15 +364,15 @@ Crear un usuario de rol administrador::
|
||||
>>> admin.save()
|
||||
>>> admin.user_admin == True
|
||||
True
|
||||
|
||||
.. Generar reporte por operario y consolidado::
|
||||
.. >>> PrintReportByOperator = Model.get('sale.print_report_by_operato`r', type='wizard')
|
||||
.. >>> session_id, _, _ = PrintReportByOperator.create()
|
||||
|
||||
Agregar un nuevo método de contacto desde prospecto
|
||||
>>> contact_method = prospect1.contact_methods.new(value='0000000000', name='Nuevo', job='Puesto increíble')
|
||||
>>> prospect1.save()
|
||||
|
||||
>>> prospect1.contact_methods[-1].value
|
||||
'0000000000'
|
||||
>>> prospect_trace.prospect_contacts[-1].value
|
||||
'0000000000'
|
||||
.. >>> print_report_by_operator = Wizard('sale.print_report_by_operator', [])
|
||||
.. >>> print_report_by_operator.form.start_date = date.today()
|
||||
.. >>> print_report_by_operator.form.end_date = date.today()
|
||||
.. >>> print_report_by_operator.execute('print_report')
|
||||
|
||||
--------
|
||||
Reportes
|
||||
|
||||
@@ -8,8 +8,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description"/>
|
||||
<newline/>
|
||||
<label name="contacts"/>
|
||||
<field name="contacts"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -4,6 +4,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="prospect_trace" expand="1"/>
|
||||
<field name="description" expand="1"/>
|
||||
<field name="contacts" expand="1"/>
|
||||
<button name="close_task"/>
|
||||
</tree>
|
||||
7
view/print_report_by_operator_start_form.xml
Normal file
7
view/print_report_by_operator_start_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. -->
|
||||
<tree>
|
||||
<field name="start_date" expand="1"/>
|
||||
<field name="end_date" expand="1"/>
|
||||
</tree>
|
||||
Reference in New Issue
Block a user