trytondo-sale_opportunity_m.../prospect_trace.py
camilogs 41036b1c59
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: Se agrega seguimiento de nivel de interés y nivel de interés actual
2023-08-03 17:55:43 +00:00

35 lines
1.2 KiB
Python

# 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.Many2One('prospect.contact_method', 'Contact method')
prospect_city = fields.Char('City')
calls = fields.One2Many('sale.call', 'prospect_trace', "Calls")
interest_types = [
('0', '0 - No contestó'),
('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')
def on_change_prospect(self):
if self.prospect:
self.prospect_name = self.prospect.name
self.prospect_city = self.prospect.city
def _get_current_interest(self, name):
return self.calls[-1].interest