feat(ProspectTrace): Se hace visible unidad de negocio, actualizandose al seleccionar prospecto, #56
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Camilo Gonzalez 2023-08-24 13:16:21 -05:00
parent a33d43cb57
commit 4ffb654814
6 changed files with 25 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class Prospect(ModelSQL, ModelView):
[('brigade', 'Brigade'),
('optics', 'Optics'),
('equipment', 'Equipment')],
'Business unit'
'Business unit', required=True
)
contact_methods = fields.One2Many(

View File

@ -16,6 +16,13 @@ class ProspectTrace(DeactivableMixin, ModelSQL, ModelView):
_states = {'readonly': True}
prospect = fields.Many2One('sale.prospect', 'Prospect', required=True)
prospect_business_unit = fields.Selection(
[('brigade', 'Brigade'),
('optics', 'Optics'),
('equipment', 'Equipment')],
'Business unit', states=_states
)
prospect_contact = fields.Many2One(
'prospect.contact_method', 'Contact method',
domain=[('prospect', '=', Eval('prospect'))])
@ -70,11 +77,12 @@ class ProspectTrace(DeactivableMixin, ModelSQL, ModelView):
if not self.prospect:
self.prospect_city = None
self.prospect_contact = None
self.prospect_business_unit = None
return
self.prospect_city = self.prospect.city
self.prospect_business_unit = self.prospect.business_unit
mobile_contact = self._get_prospect_mobile_contact()
if mobile_contact:
self.prospect_contact = mobile_contact

View File

@ -185,6 +185,8 @@ Crear seguimiento de prospecto::
>>> prospect_trace.prospect.name
'guchito S.A.S'
>>> prospect_trace.prospect_business_unit
'brigade'
>>> prospect_trace.prospect_city.name
'Medellín'
>>> prospect_trace.prospect_contact.value
@ -194,7 +196,7 @@ Crear seguimiento de prospecto::
>>> prospect_trace.prospect_contact.job
'Gerente R.H'
Crear llamadas a un seguimiento de prospecto desde el seguimiento de prospecto::
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'
@ -259,10 +261,11 @@ Cuando se asigna prospecto sin método de contacto mobile, el contacto en el seg
>>> prospect4.save()
>>> prospect_trace2 = ProspectTrace()
>>> prospect_trace2.prospect = prospect2
>>> prospect_trace2.prospect = prospect4
>>> prospect_trace2.save()
>>> prospect_trace2.prospect_contact
--------

View File

@ -24,6 +24,12 @@ class RequiredValuesTestCase(ModuleTestCase):
Prospect = pool.get('sale.prospect')
self.assertTrue(Prospect.name.required)
@with_transaction()
def test_bussiness_unit_en_Prospect_es_obligatorio(self):
pool = Pool()
Prospect = pool.get('sale.prospect')
self.assertTrue(Prospect.business_unit.required)
@with_transaction()
def test_value_en_ContactMethod_es_obligatorio(self):
pool = Pool()

View File

@ -5,6 +5,8 @@ this repository contains the full copyright notices and license terms. -->
<group col="6" colspan="5" id="header" yalign="0">
<label name="prospect"/>
<field name="prospect"/>
<label name="prospect_business_unit"/>
<field name="prospect_business_unit"/>
<label name="prospect_contact"/>
<field name="prospect_contact"/>
<label name="prospect_city"/>

View File

@ -3,6 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="prospect" expand="1"/>
<field name="prospect_business_unit" expand="1"/>
<field name="prospect_contact" expand="1"/>
<field name="prospect_city" expand="1"/>
<field name="current_interest" expand="1"/>