feat: Se agrega dominio de ciudad y departamento en creación de prospecto
This commit is contained in:
parent
beb285485d
commit
6ecb0da346
2
call.py
2
call.py
@ -26,7 +26,7 @@ class Call(ModelSQL, ModelView):
|
|||||||
def default_date(cls):
|
def default_date(cls):
|
||||||
return date.today()
|
return date.today()
|
||||||
|
|
||||||
@fields.depends('interest')
|
@fields.depends('interest', 'call_result')
|
||||||
def on_change_interest(self):
|
def on_change_interest(self):
|
||||||
if self.interest:
|
if self.interest:
|
||||||
if self.interest == '0':
|
if self.interest == '0':
|
||||||
|
10
prospect.py
10
prospect.py
@ -1,6 +1,7 @@
|
|||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from trytond.model import ModelSQL, ModelView, fields
|
from trytond.model import ModelSQL, ModelView, fields
|
||||||
|
from trytond.pyson import Eval, If
|
||||||
|
|
||||||
|
|
||||||
class Prospect(ModelSQL, ModelView):
|
class Prospect(ModelSQL, ModelView):
|
||||||
@ -13,7 +14,14 @@ class Prospect(ModelSQL, ModelView):
|
|||||||
'prospect.contact_method', 'prospect', 'Contact methods')
|
'prospect.contact_method', 'prospect', 'Contact methods')
|
||||||
|
|
||||||
department = fields.Many2One('sale.department', 'Department')
|
department = fields.Many2One('sale.department', 'Department')
|
||||||
city = fields.Many2One('sale.city', 'City')
|
city = fields.Many2One('sale.city', 'City',
|
||||||
|
domain=[If(Eval('department'),
|
||||||
|
('parent', '=', Eval('department')))])
|
||||||
|
|
||||||
|
@fields.depends('city', 'department')
|
||||||
|
def on_change_city(self):
|
||||||
|
if self.city:
|
||||||
|
self.department = self.city.parent
|
||||||
|
|
||||||
|
|
||||||
class ContactMethod(ModelSQL, ModelView):
|
class ContactMethod(ModelSQL, ModelView):
|
||||||
|
@ -47,6 +47,11 @@ Crear prospecto::
|
|||||||
>>> prospect.name = 'guchito S.A.S'
|
>>> prospect.name = 'guchito S.A.S'
|
||||||
>>> contact_method = prospect.contact_methods.new(contact_type = 'mobile', value = '31223425234')
|
>>> contact_method = prospect.contact_methods.new(contact_type = 'mobile', value = '31223425234')
|
||||||
>>> contact_method = prospect.contact_methods.new(contact_type = 'mail', value = 'peralto@guchitos.org')
|
>>> contact_method = prospect.contact_methods.new(contact_type = 'mail', value = 'peralto@guchitos.org')
|
||||||
|
|
||||||
|
.. >>> Department = Model.get('sale.department')
|
||||||
|
.. >>> cundinamarca, = Department.find([('code', '=', 'CO-25')])
|
||||||
|
.. >>> prospect.department = cundinamarca
|
||||||
|
|
||||||
>>> City = Model.get('sale.city')
|
>>> City = Model.get('sale.city')
|
||||||
>>> medellin, = City.find([('code', '=', 'CO-05001')])
|
>>> medellin, = City.find([('code', '=', 'CO-05001')])
|
||||||
>>> prospect.city = medellin
|
>>> prospect.city = medellin
|
||||||
@ -57,6 +62,11 @@ Verificar estado final de creación de prospecto::
|
|||||||
[proteus.Model.get('prospect.contact_method')(1), proteus.Model.get('prospect.contact_method')(2)]
|
[proteus.Model.get('prospect.contact_method')(1), proteus.Model.get('prospect.contact_method')(2)]
|
||||||
>>> prospect.city.parent.code
|
>>> prospect.city.parent.code
|
||||||
'CO-05'
|
'CO-05'
|
||||||
|
>>> prospect.department.code
|
||||||
|
'CO-05'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------
|
------------------------------------
|
||||||
Asignación de prospectos a operarios
|
Asignación de prospectos a operarios
|
||||||
|
Loading…
Reference in New Issue
Block a user