Engenere / BrazilFiscalReport

Python library for generating Brazilian auxiliary fiscal documents in PDF from XML documents.
GNU Lesser General Public License v3.0
27 stars 9 forks source link

avoid NoneType AttributeError with empty fields #17

Closed rvalyi closed 6 months ago

rvalyi commented 6 months ago

More specifically avoid: 'NoneType' object has no attribute 'encode' in normalize_text in fpdf/fpdf.py:4342

This fixes errors like I had in my nfelib tests with: https://github.com/akretion/nfelib/actions/runs/9001971049/job/24729276315?pr=101#step:6:182 it looks like in this test NFe xml I had an empty time_ent_sai. I think we should be lenient with such empty fields and this is what this PR does.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.05%. Comparing base (e7d702d) to head (083e860).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #17 +/- ## ======================================= Coverage 96.05% 96.05% ======================================= Files 16 16 Lines 1015 1015 Branches 91 91 ======================================= Hits 975 975 Misses 22 22 Partials 18 18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

antoniospneto commented 6 months ago

Obrigado @rvalyi !

antoniospneto commented 6 months ago

@rvalyi

Depois se você quiser ver alguns arquivos XMLs de NFe que é padrão para os clientes da Akretion, me passe que eu adiciono nos casos de usos dos testes. Por exemplo simular algum xml comum na importação ou exportação

rvalyi commented 6 months ago

alguns a gente botou no nfelib/nfe/samples porque facilitou para testar no OCA/l10n-brazil tambem. Porem são XMLs de bastante anos atras e talvez a gente conseguiria dar uma certa atualização nisso. Vamos ver isso nas próximas semanas. Novamente parabéns pelo trabalho.