chore: Se elimina código duplicado extrayendo niveles de interés en una clase aparte
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
41036b1c59
commit
a79490ed0f
11
Util/interest.py
Normal file
11
Util/interest.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class Interest():
|
||||||
|
@staticmethod
|
||||||
|
def get_interest_levels():
|
||||||
|
interest_levels = [
|
||||||
|
('0', '0 - No contestó'),
|
||||||
|
('1', '1 - total desinterés'),
|
||||||
|
('2', '2 - Interés intermedio'),
|
||||||
|
('3', '3 - Interés alto, generar venta')
|
||||||
|
]
|
||||||
|
|
||||||
|
return interest_levels
|
11
call.py
11
call.py
@ -1,5 +1,6 @@
|
|||||||
from trytond.model import ModelSQL, ModelView, fields
|
from trytond.model import ModelSQL, ModelView, fields
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
from Util.interest import Interest
|
||||||
|
|
||||||
class Call(ModelSQL, ModelView):
|
class Call(ModelSQL, ModelView):
|
||||||
'Llamada'
|
'Llamada'
|
||||||
@ -11,15 +12,7 @@ class Call(ModelSQL, ModelView):
|
|||||||
|
|
||||||
prospect_trace = fields.Many2One('sale.prospect_trace', 'Prospect track')
|
prospect_trace = fields.Many2One('sale.prospect_trace', 'Prospect track')
|
||||||
|
|
||||||
interest_types = [
|
interest = fields.Selection(Interest.get_interest_levels(), 'Interest')
|
||||||
('0', '0 - No contestó'),
|
|
||||||
('1', '1 - total desinterés'),
|
|
||||||
('2', '2 - Interés intermedio'),
|
|
||||||
('3', '3 - Interés alto, generar venta')
|
|
||||||
]
|
|
||||||
|
|
||||||
interest = fields.Selection(interest_types, 'Interest')
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_date(cls):
|
def default_date(cls):
|
||||||
|
@ -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 Util.interest import Interest
|
||||||
|
|
||||||
class ProspectTrace(ModelSQL, ModelView):
|
class ProspectTrace(ModelSQL, ModelView):
|
||||||
'Seguimiento de un prospecto'
|
'Seguimiento de un prospecto'
|
||||||
@ -14,14 +15,8 @@ class ProspectTrace(ModelSQL, ModelView):
|
|||||||
|
|
||||||
calls = fields.One2Many('sale.call', 'prospect_trace', "Calls")
|
calls = fields.One2Many('sale.call', 'prospect_trace', "Calls")
|
||||||
|
|
||||||
interest_types = [
|
_interest_field_type = fields.Selection(Interest.get_interest_levels(), 'Interest')
|
||||||
('0', '0 - No contestó'),
|
current_interest = fields.Function(_interest_field_type, '_get_current_interest')
|
||||||
('1', '1 - total desinterés'),
|
|
||||||
('2', '2 - Interés intermedio'),
|
|
||||||
('3', '3 - Interés alto, generar venta')
|
|
||||||
]
|
|
||||||
|
|
||||||
current_interest = fields.Function(fields.Selection(interest_types, 'Interest'), '_get_current_interest')
|
|
||||||
|
|
||||||
@fields.depends('prospect')
|
@fields.depends('prospect')
|
||||||
def on_change_prospect(self):
|
def on_change_prospect(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user