Skip to content

Commit

Permalink
[FIX] l10n_br_cte: fix get active id to generate obscont and obsfisco
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Jul 19, 2024
1 parent eb5356d commit 7e5cfc2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions l10n_br_cte/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ 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":
if self.env.context["params"]["model"] == "l10n_br_fiscal.document":
doc = self.env["l10n_br_fiscal.document"].browse(
self.env.context["params"]["id"]
)
vals = {"user": self.env.user, "ctx": self._context, "doc": doc}
message = self.compute_message(vals).strip()
if self.comment_type == "fiscal":
return message[:60]
return message[:160]
active_id = self.env.context["active_id"]
doc = self.env["l10n_br_fiscal.document"].browse(active_id)
vals = {"user": self.env.user, "ctx": self._context, "doc": doc}
message = self.compute_message(vals).strip()
if self.comment_type == "fiscal":
return message[:60]
return message[:160]
return super()._export_field(xsd_field, class_obj, member_spec, export_value)

0 comments on commit 7e5cfc2

Please sign in to comment.