chore: se hacen obligatorios campos pertinentes en Prospect y ContactMethod
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Camilo Gonzalez 2023-08-09 19:52:03 -05:00
parent e6cc5e524e
commit cd3ab0247d
3 changed files with 50 additions and 26 deletions

View File

@ -9,7 +9,7 @@ class Prospect(ModelSQL, ModelView):
__name__ = 'sale.prospect'
_rec_name = 'name'
name = fields.Char('Name')
name = fields.Char('Name', required=True)
contact_methods = fields.One2Many(
'prospect.contact_method',
@ -35,13 +35,13 @@ class ContactMethod(ModelSQL, ModelView):
('mobile', 'Mobile'),
('mail', 'Mail')
]
contact_type = fields.Selection(_type, 'Contact type')
contact_type = fields.Selection(_type, 'Contact type', required=True)
value = fields.Char('Value')
value = fields.Char('Value', required=True)
name = fields.Char('Name')
job = fields.Char('job')
prospect = fields.Many2One('sale.prospect', 'Prospect')
prospect = fields.Many2One('sale.prospect', 'Prospect', required=True)
def get_rec_name(self, name):
fields = [self.name, self.job, self.value]

View File

@ -1,22 +0,0 @@
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
class SaleOpportunityManagementTestCase(ModuleTestCase):
"Test Sale Opportunity Management module"
module = 'sale_opportunity_management'
@with_transaction()
def test_prospecto_en_prospect_trace_es_obligatorio(self):
pool = Pool()
ProspectTrace = pool.get('sale.prospect_trace')
self.assertTrue(ProspectTrace.prospect.required)
@with_transaction()
def test_contact_method_en_prospect_es_obligatorio(self):
pool = Pool()
Prospect = pool.get('sale.prospect')
self.assertTrue(Prospect.contact_methods.required)
del ModuleTestCase

View File

@ -0,0 +1,46 @@
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
class RequiredValuesTestCase(ModuleTestCase):
"Test Sale Opportunity Management module"
module = 'sale_opportunity_management'
@with_transaction()
def test_prospecto_en_prospect_trace_es_obligatorio(self):
pool = Pool()
ProspectTrace = pool.get('sale.prospect_trace')
self.assertTrue(ProspectTrace.prospect.required)
@with_transaction()
def test_contact_method_en_prospect_es_obligatorio(self):
pool = Pool()
Prospect = pool.get('sale.prospect')
self.assertTrue(Prospect.contact_methods.required)
@with_transaction()
def test_name_en_prospect_es_obligatorio(self):
pool = Pool()
Prospect = pool.get('sale.prospect')
self.assertTrue(Prospect.name.required)
@with_transaction()
def test_value_en_contact_method_es_obligatorio(self):
pool = Pool()
ContactMethod = pool.get('prospect.contact_method')
self.assertTrue(ContactMethod.value.required)
@with_transaction()
def test_contact_type_en_contact_method_es_obligatorio(self):
pool = Pool()
ContactMethod = pool.get('prospect.contact_method')
self.assertTrue(ContactMethod.contact_type.required)
@with_transaction()
def test_prospect_en_contact_method_es_obligatorio(self):
pool = Pool()
ContactMethod = pool.get('prospect.contact_method')
self.assertTrue(ContactMethod.prospect.required)
del ModuleTestCase