Skip to content

Commit

Permalink
l10n_br_fiscal_edi: don't break with draft docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Jan 15, 2025
1 parent 236418b commit f0bc18b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions l10n_br_fiscal_edi/models/document_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ def _save_event_2disk(self, arquivo, file_name):
numero = self.document_number

if self.document_id:
ano = self.document_id.document_date.strftime("%Y")
mes = self.document_id.document_date.strftime("%m")
document_date = (
self.document_id.document_date or self.document_id.create_date
)
ano = document_date.strftime("%Y")
mes = document_date.strftime("%m")
elif self.invalidate_number_id:
ano = self.invalidate_number_id.date.strftime("%Y")
mes = self.invalidate_number_id.date.strftime("%m")
Expand Down

0 comments on commit f0bc18b

Please sign in to comment.