Merge pull request 'walking_skeleton/views' (#6) from walking_skeleton into 6.8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Reviewed-on: #6
This commit is contained in:
Camilo Gonzalez 2023-07-29 21:14:39 -05:00
commit e589908e1c
17 changed files with 342 additions and 2 deletions

2
.gitignore vendored
View File

@ -5,6 +5,8 @@ __pycache__/
*$py.class
*.bk
/.vscode
# C extensions
*.so

View File

@ -1,10 +1,17 @@
from trytond.pool import Pool
from . import prospect
from . import prospect_trace
from . import call
__all__ = ['register']
def register():
Pool.register(
call.Call,
prospect.Prospect,
prospect.ContactMethod,
prospect_trace.ProspectTrace,
module='sale_opportunity_management', type_='model')
Pool.register(
module='sale_opportunity_management', type_='wizard')

16
call.py Normal file
View File

@ -0,0 +1,16 @@
from trytond.model import ModelSQL, ModelView, fields
from datetime import date
class Call(ModelSQL, ModelView):
'Llamada'
__name__ = 'sale.call'
date = fields.Date('Date')
description = fields.Char('Description')
prospect_trace = fields.Many2One('sale.prospect_trace', 'Prospect track')
@classmethod
def default_date(cls):
return date.today()

43
call.xml Normal file
View File

@ -0,0 +1,43 @@
<?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.act_window" id="act_call_tree">
<field name="name">Calls</field>
<field name="res_model">sale.call</field>
</record>
<record model="ir.ui.view" id="call_view_tree">
<field name="model">sale.call</field>
<field name="type">tree</field>
<field name="name">call_tree</field>
</record>
<record model="ir.ui.view" id="call_view_form">
<field name="model">sale.call</field>
<field name="type">form</field>
<field name="name">call_form</field>
</record>
<record model="ir.action.act_window.view" id="act_call_tree_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="call_view_tree"/>
<field name="act_window" ref="act_call_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_call_form_view1">
<field name="sequence" eval="20"/>
<field name="view" ref="call_view_form"/>
<field name="act_window" ref="act_call_tree"/>
</record>
<menuitem
name="Calls"
sequence="10"
id="menu_calls"/>
<menuitem
parent="menu_calls"
sequence="30"
id="menu_calls_tree"
action="act_call_tree"/>
</data>
</tryton>

View File

@ -57,8 +57,7 @@ Seguimiento de prospecto 2
* 1 - total desinterés
* 2 - Interés intermedio, brindar mas información
* 3 - Interés alto, generar venta
* Estado (realizada - pendiente)
* Seguimiento de prospecto al que pertence
--------

29
prospect.py Normal file
View File

@ -0,0 +1,29 @@
# 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
class Prospect(ModelSQL, ModelView):
'Prospecto'
__name__ = 'sale.prospect'
name = fields.Char('Name')
city = fields.Char('City')
contact_methods = fields.One2Many('prospect.contact_method', 'prospect', 'Contact methods')
class ContactMethod(ModelSQL, ModelView):
'Mecanismo de contacto'
__name__ = 'prospect.contact_method'
_type = [
('phone', 'Phone'),
('mobile', 'Mobile'),
('email', 'Email')
]
contact_type = fields.Selection(_type, 'Contact type')
value = fields.Char('Value')
prospect = fields.Many2One('sale.prospect', 'Prospect')

39
prospect.xml Normal file
View File

@ -0,0 +1,39 @@
<?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.act_window" id="act_prospect_tree">
<field name="name">Prospects</field>
<field name="res_model">sale.prospect</field>
</record>
<record model="ir.ui.view" id="prospect_view_tree">
<field name="model">sale.prospect</field>
<field name="type">tree</field>
<field name="name">prospect_tree</field>
</record>
<record model="ir.ui.view" id="prospect_view_form">
<field name="model">sale.prospect</field>
<field name="type">form</field>
<field name="name">prospect_form</field>
</record>
<record model="ir.action.act_window.view" id="act_prospect_tree_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="prospect_view_tree"/>
<field name="act_window" ref="act_prospect_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_prospect_form_view1">
<field name="sequence" eval="20"/>
<field name="view" ref="prospect_view_form"/>
<field name="act_window" ref="act_prospect_tree"/>
</record>
<menuitem
parent="menu_calls"
sequence="10"
id="menu_prospects_tree"
action="act_prospect_tree"/>
</data>
</tryton>

22
prospect_trace.py Normal file
View File

@ -0,0 +1,22 @@
# 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
class ProspectTrace(ModelSQL, ModelView):
'Seguimiento de un prospecto'
__name__ = 'sale.prospect_trace'
prospect = fields.Many2One('sale.prospect', 'Prospect')
prospect_name = fields.Char('Name')
prospect_contact = fields.Char('Contact')
prospect_city = fields.Char('City')
calls = fields.One2Many('sale.call', 'prospect_trace', "Calls")
@fields.depends('prospect')
def on_change_prospect(self):
if self.prospect:
self.prospect_name = self.prospect.name
# self.prospect_contact = self.prospect.contact_methods.index('contact_type 'mobile')
self.prospect_city = self.prospect.city

39
prospect_trace.xml Normal file
View File

@ -0,0 +1,39 @@
<?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.act_window" id="act_prospect_trace_tree">
<field name="name">Prospect Traces</field>
<field name="res_model">sale.prospect_trace</field>
</record>
<record model="ir.ui.view" id="prospect_trace_view_tree">
<field name="model">sale.prospect_trace</field>
<field name="type">tree</field>
<field name="name">prospect_trace_tree</field>
</record>
<record model="ir.ui.view" id="prospect_trace_view_form">
<field name="model">sale.prospect_trace</field>
<field name="type">form</field>
<field name="name">prospect_trace_form</field>
</record>
<record model="ir.action.act_window.view" id="act_prospect_trace_tree_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="prospect_trace_view_tree"/>
<field name="act_window" ref="act_prospect_trace_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_prospect_trace_form_view1">
<field name="sequence" eval="20"/>
<field name="view" ref="prospect_trace_view_form"/>
<field name="act_window" ref="act_prospect_trace_tree"/>
</record>
<menuitem
parent="menu_calls"
sequence="20"
id="menu_prospect_trace_tree"
action="act_prospect_trace_tree"/>
</data>
</tryton>

View File

@ -6,7 +6,78 @@ Imports::
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from datetime import date
Activate modules::
>>> config = activate_modules('sale_opportunity_management')
---------------------------------------------------------------------------------------------
Como administrador quiero registrar un prospecto para lugo poder hacerle un seguimiento
---------------------------------------------------------------------------------------------
Crear mecanismos de contacto::
Crear prospecto::
>>> Prospect = Model.get('sale.prospect')
>>> prospect = Prospect()
>>> prospect.name = 'guchito S.A.S'
>>> prospect.city = 'Bogotá'
>>> phone = prospect.contact_methods.new()
>>> phone.contact_type = 'mobile'
>>> phone.value = '3132923938'
>>> prospect.save()
-----------------------------------------------------------------------------------------
Como operador quiero poder crear un seguimiento de prospecto para luego hacer una llamada
-----------------------------------------------------------------------------------------
Crear seguimiento de prospecto::
>>> ProspectTrace = Model.get('sale.prospect_trace')
>>> prospect_trace = ProspectTrace()
>>> prospect_trace.prospect = prospect
>>> prospect_trace.save()
>>> prospect_trace.prospect_name
'guchito S.A.S'
>>> prospect_trace.prospect_city
'Bogotá'
----------------------------------------------------------------------------
Como operador quiero registrar una llamada para luego generar reportes
----------------------------------------------------------------------------
Crear llamada a un seguimiento de prospecto::
>>> Call = Model.get('sale.call')
>>> call = Call()
>>> call.description = 'Descripción u observaciones de la llamada'
>>> call.prospect_trace = prospect_trace
>>> call.save()
>>> call.prospect_trace.prospect_name
'guchito S.A.S'
>>> call.date == date.today()
True
Crear otra llamada al mismo seguimiento de prospecto::
>>> Call = Model.get('sale.call')
>>> call = Call()
>>> call.description = 'Segunda llamada al mismo seguimiento'
>>> call.prospect_trace = prospect_trace
>>> call.save()
>>> call.prospect_trace.prospect_name
'guchito S.A.S'
>>> call.prospect_trace.prospect_city
'Bogotá'
>>> call.date == date.today()
True
>>> len(prospect_trace.calls) == 2
True

View File

@ -3,3 +3,6 @@ version=6.8.0
depends:
ir
xml:
call.xml
prospect_trace.xml
prospect.xml

13
view/call_form.xml Normal file
View File

@ -0,0 +1,13 @@
<?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="date"/>
<field name="date"/>
<label name="prospect_trace"/>
<field name="prospect_trace"/>
<label name="description"/>
<field name="description"/>
</form>

8
view/call_tree.xml Normal file
View File

@ -0,0 +1,8 @@
<?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="date"/>
<field name="description"/>
<field name="prospect_trace"/>
</tree>

13
view/prospect_form.xml Normal file
View File

@ -0,0 +1,13 @@
<?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="name"/>
<field name="name"/>
<label name="city"/>
<field name="city"/>
<label name="contact_methods"/>
<field name="contact_methods"/>
</form>

View File

@ -0,0 +1,19 @@
<?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="prospect"/>
<field name="prospect"/>
<label name="prospect_name"/>
<field name="prospect_name"/>
<label name="prospect_contact"/>
<field name="prospect_contact"/>
<label name="prospect_city"/>
<field name="prospect_city"/>
<label name="calls"/>
<field name="calls"/>
</form>

View File

@ -0,0 +1,9 @@
<?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="prospect"/>
<field name="prospect_name"/>
<field name="prospect_contact"/>
<field name="prospect_city"/>
</tree>

8
view/prospect_tree.xml Normal file
View File

@ -0,0 +1,8 @@
<?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="name"/>
<field name="city"/>
<field name="contact_methods"/>
</tree>