From 0be22b32984afeec5924ddbf1978cd754d909376 Mon Sep 17 00:00:00 2001
From: camilogs <camilo.gonzalez.col@gmail.com>
Date: Sun, 13 Aug 2023 17:36:43 -0500
Subject: [PATCH] feat: se hace por defecto el tipo mobile en contact_type,
 closed #30

---
 prospect.py                                    | 9 ++++++---
 tests/scenario_sale_opportunity_management.rst | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/prospect.py b/prospect.py
index b9f4c58..3a957ee 100644
--- a/prospect.py
+++ b/prospect.py
@@ -30,12 +30,11 @@ class ContactMethod(ModelSQL, ModelView):
     'Mecanismo de contacto'
     __name__ = 'prospect.contact_method'
 
-    _type = [
+    contact_type = fields.Selection([
         ('phone', 'Phone'),
         ('mobile', 'Mobile'),
         ('mail', 'Mail')
-    ]
-    contact_type = fields.Selection(_type, 'Contact type', required=True)
+        ], 'Contact type', required=True)
 
     value = fields.Char('Value', required=True)
     name = fields.Char('Name')
@@ -43,6 +42,10 @@ class ContactMethod(ModelSQL, ModelView):
 
     prospect = fields.Many2One('sale.prospect', 'Prospect', required=True)
 
+    @classmethod
+    def default_contact_type(cls):
+        return 'mobile'
+
     def get_rec_name(self, name):
         fields = [self.name, self.job, self.value]
         contact_rec_name = ''
diff --git a/tests/scenario_sale_opportunity_management.rst b/tests/scenario_sale_opportunity_management.rst
index 76c6fe1..e5c9fca 100644
--- a/tests/scenario_sale_opportunity_management.rst
+++ b/tests/scenario_sale_opportunity_management.rst
@@ -45,7 +45,7 @@ Crear prospecto::
     >>> prospect = Prospect()
     
     >>> prospect.name = 'guchito S.A.S'
-    >>> contact_method = prospect.contact_methods.new(contact_type='mobile', value='31223425234', name='Roberto', job='Gerente R.H') 
+    >>> contact_method = prospect.contact_methods.new(value='31223425234', name='Roberto', job='Gerente R.H') 
     >>> contact_method = prospect.contact_methods.new(contact_type='mobile', value='12345678910', name='Pancracia', job='Asistente administrativo') 
     >>> contact_method = prospect.contact_methods.new(contact_type='mail', value='peralto@guchitos.org', name='Peralto', job='Administrador')