diff --git a/Util/call_types.py b/Util/call_types.py index fe175f1..c4dc715 100644 --- a/Util/call_types.py +++ b/Util/call_types.py @@ -6,4 +6,4 @@ class CallTypes(): ('followup_call', 'Follow up call'), ] - return call_types \ No newline at end of file + return call_types diff --git a/Util/interest.py b/Util/interest.py index dc42c8f..1e6fcd5 100644 --- a/Util/interest.py +++ b/Util/interest.py @@ -8,4 +8,4 @@ class Interest(): ('3', '3 - Interés alto, generar venta') ] - return interest_levels \ No newline at end of file + return interest_levels diff --git a/call.py b/call.py index df2abf3..6669ad3 100644 --- a/call.py +++ b/call.py @@ -1,12 +1,13 @@ -from trytond.model import ModelSQL, ModelView, fields +from trytond.model import ModelSQL, ModelView, fields from datetime import date from .Util.interest import Interest from .Util.call_types import CallTypes + class Call(ModelSQL, ModelView): 'Llamada' - + __name__ = 'sale.call' date = fields.Date('Date') @@ -19,4 +20,4 @@ class Call(ModelSQL, ModelView): @classmethod def default_date(cls): - return date.today() \ No newline at end of file + return date.today() diff --git a/prospect.py b/prospect.py index 82c44f4..3f3996c 100644 --- a/prospect.py +++ b/prospect.py @@ -1,6 +1,7 @@ # 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 +from trytond.model import ModelSQL, ModelView, fields + class Prospect(ModelSQL, ModelView): 'Prospecto' @@ -9,14 +10,15 @@ class Prospect(ModelSQL, ModelView): name = fields.Char('Name') city = fields.Char('City') - contact_methods = fields.One2Many('prospect.contact_method', 'prospect', 'Contact methods') + contact_methods = fields.One2Many( + 'prospect.contact_method', 'prospect', 'Contact methods') class ContactMethod(ModelSQL, ModelView): 'Mecanismo de contacto' __name__ = 'prospect.contact_method' _rec_name = 'value' - + _type = [ ('phone', 'Phone'), ('mobile', 'Mobile'), @@ -27,4 +29,3 @@ class ContactMethod(ModelSQL, ModelView): value = fields.Char('Value') prospect = fields.Many2One('sale.prospect', 'Prospect') - diff --git a/prospect_trace.py b/prospect_trace.py index ebab263..7013e88 100644 --- a/prospect_trace.py +++ b/prospect_trace.py @@ -1,23 +1,27 @@ # 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 +from trytond.model import ModelSQL, ModelView, fields from .Util.interest import Interest + 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') + prospect_contact = fields.Many2One( + 'prospect.contact_method', 'Contact method') + prospect_city = fields.Char('City') - calls = fields.One2Many('sale.call', 'prospect_trace', "Calls") + calls = fields.One2Many('sale.call', 'prospect_trace', "Calls") + + _interest_field_type = fields.Selection( + Interest.get_interest_levels(), 'Interest') + current_interest = fields.Function( + _interest_field_type, '_get_current_interest') - _interest_field_type = fields.Selection(Interest.get_interest_levels(), 'Interest') - current_interest = fields.Function(_interest_field_type, '_get_current_interest') - @fields.depends('prospect') def on_change_prospect(self): if self.prospect: @@ -26,4 +30,3 @@ class ProspectTrace(ModelSQL, ModelView): def _get_current_interest(self, name): return self.calls[-1].interest -