diff --git a/l10n_br_fiscal/constants/fiscal.py b/l10n_br_fiscal/constants/fiscal.py
index f572f436b869..fcd0cd468d59 100644
--- a/l10n_br_fiscal/constants/fiscal.py
+++ b/l10n_br_fiscal/constants/fiscal.py
@@ -351,11 +351,11 @@
]
AUTORIZADO = ("100", "150")
-DENEGADO = ("110", "301", "302")
+DENEGADO = ("110", "301", "302", "303")
LOTE_RECEBIDO = ["103"]
LOTE_PROCESSADO = ["104"]
LOTE_EM_PROCESSAMENTO = ["105"]
-CONTINGENCIA = ("108", "109")
+SERVICO_PARALIZADO = ("108", "109")
CANCELAMENTO_HOMOLOGADO = ["101", "151"]
diff --git a/l10n_br_fiscal/models/document_event.py b/l10n_br_fiscal/models/document_event.py
index d613ce041e9f..f6bd5231d20d 100644
--- a/l10n_br_fiscal/models/document_event.py
+++ b/l10n_br_fiscal/models/document_event.py
@@ -69,7 +69,7 @@ def _compute_display_name(self):
type = fields.Selection(
selection=[
("-1", "Exception"),
- ("0", "Envio Lote"),
+ ("0", "Autorização de Uso"),
("1", "Consulta Recibo"),
("2", "Cancelamento"),
("3", "Inutilização"),
@@ -185,6 +185,13 @@ def _compute_display_name(self):
protocol_number = fields.Char()
+ lot_receipt_number = fields.Char(
+ help=(
+ "In asynchronous processing, a lot receipt number is generated, "
+ "which is used for later consultation."
+ ),
+ )
+
state = fields.Selection(
selection=[
("draft", _("Draft")),
@@ -300,7 +307,7 @@ def _save_event_file(
)
if authorization:
- # Nâo deletamos um aquivo de autorização já
+ # Não deletamos um aquivo de autorização já
# Existente por segurança
self.file_response_id = False
self.file_response_id = attachment_id
@@ -312,7 +319,8 @@ def _save_event_file(
def set_done(
self, status_code, response, protocol_date, protocol_number, file_response_xml
):
- self._save_event_file(file_response_xml, "xml", authorization=True)
+ if file_response_xml:
+ self._save_event_file(file_response_xml, "xml", authorization=True)
self.write(
{
"state": "done",
diff --git a/l10n_br_fiscal/models/document_workflow.py b/l10n_br_fiscal/models/document_workflow.py
index 9491baa45bfc..8ee3f9d966e7 100644
--- a/l10n_br_fiscal/models/document_workflow.py
+++ b/l10n_br_fiscal/models/document_workflow.py
@@ -199,7 +199,7 @@ def _after_change_state(self, old_state, new_state):
self._generates_subsequent_operations()
- def _change_state(self, new_state):
+ def _change_state(self, new_state, force_change=False):
"""Método para alterar o estado do documento fiscal, mantendo a
integridade do workflow da invoice.
@@ -215,7 +215,9 @@ def _change_state(self, new_state):
for record in self:
old_state = record.state_edoc
- if not record._avaliable_transition(old_state, new_state):
+ if force_change or record._avaliable_transition(old_state, new_state):
+ pass
+ else:
raise UserError(
_(
"Não é possível realizar esta operação,\n"
diff --git a/l10n_br_fiscal/views/document_event_view.xml b/l10n_br_fiscal/views/document_event_view.xml
index b72801e17cde..27f820b6d131 100644
--- a/l10n_br_fiscal/views/document_event_view.xml
+++ b/l10n_br_fiscal/views/document_event_view.xml
@@ -50,6 +50,7 @@
+
diff --git a/l10n_br_fiscal/views/document_view.xml b/l10n_br_fiscal/views/document_view.xml
index 1a2f2a43d9bc..c90641fa15ea 100644
--- a/l10n_br_fiscal/views/document_view.xml
+++ b/l10n_br_fiscal/views/document_view.xml
@@ -89,7 +89,6 @@