Skip to content

Commit

Permalink
[FIX] l10n_br_cte: fix cte comments compute
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Sep 16, 2024
1 parent bdb2d2d commit a9eda94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 3 additions & 8 deletions l10n_br_cte/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ def _export_field(self, xsd_field, class_obj, member_spec, export_value=None):
if xsd_field == "cte40_xCampo":
return self.name[:20].strip()
if xsd_field == "cte40_xTexto":
# Aparentemente isso terá que ser feito de outra forma
if (
"active_id" in self.env.context
and self.env.context.get("active_model")
== "l10n_br_fiscal.document.line"
):
active_id = self.env.context["active_id"]
doc = self.env["l10n_br_fiscal.document"].browse(active_id)
if "doc" in self.env.context:
doc_id = self.env.context["doc"]
doc = self.env["l10n_br_fiscal.document"].browse(doc_id)
vals = {"user": self.env.user, "ctx": self._context, "doc": doc}
message = self.compute_message(vals).strip()
if self.comment_type == "fiscal":
Expand Down
1 change: 1 addition & 0 deletions l10n_br_cte/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@ def _export_field(self, xsd_field, class_obj, member_spec, export_value=None):
if xsd_field == "cte40_tpAmb":
self.env.context = dict(self.env.context)
self.env.context.update({"tpAmb": self[xsd_field]})
self.env.context.update({"doc": self.id})

# TODO: Força a remoção da tag infGlobalizado já que o
# campo xObs está no l10n_br_fiscal.document
Expand Down

0 comments on commit a9eda94

Please sign in to comment.