/usr/bin/python2.7
/home/silex/Desktop/pycharm-2.7.1/helpers/pycharm/utrunner.py
/opt/silex/tryton/nfse_br/tests/test_nfse_br.py::TestCase::test0010create_invoice
true
Testing started at 20:08 ...
NFSe_Util v2.2 beta 19-09-2012 - © 2012 - www.flexdocs.com.br - Todos os
direitos reservados
/opt/trytond/trytond/model/modelstorage.py:1309: DeprecationWarning:
With-statements now directly support multiple context managers
Transaction().set_context(self._context)):
/opt/trytond/trytond/model/fields/reference.py:72: DeprecationWarning:
With-statements now directly support multiple context managers
Transaction().set_user(0)):
/opt/trytond/trytond/model/modelstorage.py:1385: DeprecationWarning:
With-statements now directly support multiple context managers
Transaction().set_context(self._context)):
/opt/trytond/trytond/ir/rule.py:219: DeprecationWarning: With-statements
now directly support multiple context managers
Transaction().set_context(user=0)):
/opt/trytond/trytond/ir/rule.py:259: DeprecationWarning: With-statements
now directly support multiple context managers
Transaction().set_context(active_test=False, user=0)):
/opt/trytond/trytond/modules/__init__.py:371: DeprecationWarning:
With-statements now directly support multiple context managers
with contextmanager:
Error
Traceback (most recent call last):
File "/opt/silex/tryton/nfse_br/tests/test_nfse_br.py", line 61, in
test0010create_invoice
'legal_type': LEGAL_TYPE_DIC['juridica']['id']
File "/opt/trytond/trytond/model/modelsql.py", line 336, in create
field = cls._fields[fname]
KeyError: 'optante_simples'
It's giving me error on 'optante_simples' field. If I remove it, the
same error occurs to the next field 'cnpj'.
Here is the test (just the part where is giving the error)
def test0010create_invoice(self):
'''
Create invoics.
'''
faker = Factory.create('pt_BR')
with Transaction().start(DB_NAME, USER,
context=CONTEXT) as transaction:
party = self.party.create([{
'name': faker.name(),
'im': '04688279',
'optante_simples': True,
'cnpj': '12004152000141',
'legal_type': LEGAL_TYPE_DIC['juridica']['id']
}])
Why it gives no error on field 'im'? It's one of my fields too.
I checked the field names and it's ok:
class Party:
__name__ = 'party.party'
legal_type = fields.Selection(LEGAL_TYPE, 'Type', required = True)
cpf = fields.Char(u'CPF',
states={
'invisible': Eval('legal_type', 'fisica')
!= 'fisica',
},
)
rg = fields.Char(u'RG',
states={
'invisible': Eval('legal_type', 'fisica')
!= 'fisica',
},
)
cnpj = fields.Char(u'CNPJ',
states={
'invisible': Eval('legal_type', 'juridica') !=
'juridica',
},
)
ie = fields.Char(u'Inscrição Estadual',
states={
'invisible': Eval('legal_type',
'juridica') != 'juridica',
},
)
im = fields.Char(u'Inscrição Municipal',
states={
'invisible': Eval('legal_type',
'juridica') != 'juridica',
},
)
cnae = fields.Char(u'Nº CNAE',
states={
'invisible': Eval('legal_type',
'juridica') != 'juridica',
},
)
contribuinte_ipi = fields.Boolean(u'Contribuinte de IPI',
states={
'invisible':
Eval('legal_type', 'juridica') != 'juridica',
},
)
optante_simples = fields.Boolean(u'Optante pelo Simples',
states={
'invisible':
Eval('legal_type', 'juridica') != 'juridica',
},
)
--
Iasmini Gomes
Sílex Sistemas
www.silexsistemas.com.br
---
Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus
está ativa.
http://www.avast.com