Skip to content

Commit

Permalink
[RFC] l10n_br_cte: ultra mega power refactor :D
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Jul 19, 2024
1 parent bcb8875 commit eb5356d
Show file tree
Hide file tree
Showing 8 changed files with 322 additions and 349 deletions.
10 changes: 8 additions & 2 deletions l10n_br_cte/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@


class CTeComment(spec_models.StackedModel):

_name = "l10n_br_fiscal.comment"
_inherit = ["l10n_br_fiscal.comment", "cte.40.tcte_obscont"]
_inherit = ["l10n_br_fiscal.comment", "cte.40.tcte_obscont", "cte.40.tcte_obsfisco"]
_stacked = "cte.40.tcte_obscont"
_field_prefix = "cte40_"
_schema_name = "cte"
_schema_version = "4.0.0"
_odoo_module = "l10n_br_cte"
_spec_module = "odoo.addons.l10n_br_cte_spec.models.v4_0.cte_tipos_basico_v4_00"
_spec_tab_name = "CTe"
_stacking_points = {}
_stack_skip = ("cte40_ObsCont_compl_id", "cte40_ObsFisco_compl_id")
_binding_module = "nfelib.cte.bindings.v4_0.cte_tipos_basico_v4_00"

cte40_xCampo = fields.Char()
Expand All @@ -31,5 +34,8 @@ def _export_field(self, xsd_field, class_obj, member_spec, export_value=None):
self.env.context["params"]["id"]
)
vals = {"user": self.env.user, "ctx": self._context, "doc": doc}
return self.compute_message(vals)[:160].strip()
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)
Loading

0 comments on commit eb5356d

Please sign in to comment.