Skip to content

Commit

Permalink
[WIP] Modals in Infctenorm
Browse files Browse the repository at this point in the history
  • Loading branch information
ODBreno committed Oct 23, 2023
1 parent 47c0a4b commit cbfd8a1
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
7 changes: 6 additions & 1 deletion l10n_br_cte/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,11 @@ def _compute_infresptec(self):
),
)

cte40_chCTeFerroOrigem = fields.Char(
string="Chave de acesso do CT-e emitido",
help="Chave de acesso do CT-e emitido pelo ferrovia de origem",
)

cte40_ferroEnv = fields.Many2many(
comodel_name="res.partner",
string="Informações das Ferrovias Envolvidas",
Expand Down Expand Up @@ -737,7 +742,7 @@ def _compute_cte40_vPrest(self):
vPrest += record.cte40_vTPrest
self.cte40_vPrest = vPrest

def _export_fields_cte_40_infmodal(self, xsd_fields, class_obj, export_dict):
def _export_fields_cte_40_tcte_infmodal(self, xsd_fields, class_obj, export_dict):
self = self.with_context(module="l10n_br_cte")

if self.cte40_modal == "1":
Expand Down
2 changes: 2 additions & 0 deletions l10n_br_cte/models/ferroviario.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class Ferroviario(spec_models.StackedModel):
default=lambda self: self.env.company.currency_id,
)

cte40_chCTeFerroOrigem = fields.Char(related="document_id.cte40_chCTeFerroOrigem")

cte40_respFat = fields.Selection(related="document_id.cte40_respFat")

cte40_ferrEmi = fields.Selection(related="document_id.cte40_ferrEmi")
Expand Down
93 changes: 93 additions & 0 deletions l10n_br_cte/models/normal_cte_infos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,96 @@ class CTeNormalInfos(spec_models.StackedModel):
comodel_name="l10n_br_fiscal.document.related",
related="document_id.document_related_ids",
)

cte40_versaoModal = fields.Char(related="document_id.cte40_versaoModal")

# Campos do Modal Aereo
modal_aereo_id = fields.Many2one(
comodel_name="l10n_br_cte.modal.aereo", related="document_id.modal_aereo_id"
)

cte40_nMinu = fields.Char(related="document_id.cte40_nMinu")

cte40_nOCA = fields.Char(related="document_id.cte40_nOCA")

cte40_dPrevAereo = fields.Date(related="document_id.cte40_dPrevAereo")

cte40_xDime = fields.Char(related="document_id.cte40_xDime")

cte40_CL = fields.Char(related="document_id.cte40_CL")

cte40_cTar = fields.Char(related="document_id.cte40_cTar")

# Existem dois vTar no spec, um float e um monetary, por isso a mudança de nome
cte40_aereo_vTar = fields.Monetary(related="document_id.cte40_aereo_vTar")

cte40_peri = fields.One2many(
comodel_name="l10n_br_cte.modal.aereo.peri", related="document_id.cte40_peri"
)

# Campos do Modal Aquaviario
modal_aquaviario_id = fields.Many2one(
comodel_name="l10n_br_cte.modal.aquaviario",
related="document_id.modal_aquaviario_id",
)

cte40_vPrest = fields.Monetary(related="document_id.cte40_vPrest")

cte40_vAFRMM = fields.Monetary(related="document_id.cte40_vAFRMM")

cte40_xNavio = fields.Char(related="document_id.cte40_xNavio")

cte40_nViag = fields.Char(related="document_id.cte40_nViag")

cte40_direc = fields.Selection(related="document_id.cte40_direc")

cte40_irin = fields.Char(related="document_id.cte40_irin")

cte40_tpNav = fields.Selection(related="document_id.cte40_tpNav")

cte40_balsa = fields.One2many(
comodel_name="l10n_br_cte.modal.aquaviario.balsa",
related="document_id.cte40_balsa",
)

# Campos do Modal Dutoviario
modal_dutoviario_id = fields.Many2one(
comodel_name="l10n_br_cte.modal.dutoviario",
related="document_id.modal_dutoviario_id",
)

cte40_dIni = fields.Date(related="document_id.cte40_dIni")

cte40_dFim = fields.Date(related="document_id.cte40_dFim")

cte40_vTar = fields.Float(related="document_id.cte40_vTar")

# Campos do Modal Ferroviario
modal_ferroviario_id = fields.Many2one(
comodel_name="l10n_br_cte.modal.ferroviario",
related="document_id.modal_ferroviario_id",
)

cte40_tpTraf = fields.Selection(related="document_id.cte40_tpTraf")

cte40_fluxo = fields.Char(related="document_id.cte40_fluxo")

cte40_vFrete = fields.Monetary(related="document_id.cte40_vFrete")

cte40_respFat = fields.Selection(related="document_id.cte40_respFat")

cte40_ferrEmi = fields.Selection(related="document_id.cte40_ferrEmi")

cte40_ferroEnv = fields.Many2many(related="document_id.cte40_ferroEnv")

# Campos do Modal rodoviario
modal_rodoviario_id = fields.Many2one(
comodel_name="l10n_br_cte.modal.rodoviario",
related="document_id.modal_rodoviario_id",
)

cte40_RNTRC = fields.Char(related="document_id.cte40_RNTRC")

cte40_occ = fields.One2many(
comodel_name="l10n_br_cte.modal.rodoviario.occ", related="document_id.cte40_occ"
)
1 change: 1 addition & 0 deletions l10n_br_cte/views/cte_document.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<field name="cte40_tpTraf" />
<field name="cte40_fluxo" />
<field name="cte40_vFrete" />
<field name="cte40_chCTeFerroOrigem" />
<field name="cte40_respFat" />
<field name="cte40_ferrEmi" />
<field
Expand Down

0 comments on commit cbfd8a1

Please sign in to comment.