-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
470 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2023 KMEE INFORMATICA LTDA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields | ||
|
||
from odoo.addons.spec_driven_model.models import spec_models | ||
|
||
|
||
class Aereo(spec_models.SpecModel): | ||
_name = "l10n_br_cte.aereo" | ||
_inherit = "cte.40.aereo" | ||
|
||
document_id = fields.One2many( | ||
comodel_name="l10n_br_fiscal.document", inverse_name="cte40_aereo" | ||
) | ||
|
||
cte40_dPrevAereo = fields.Date(related="dPrevAereo", store=True) | ||
|
||
dPrevAereo = fields.Date( | ||
string="Data prevista da entrega", | ||
help="Data prevista da entrega\nFormato AAAA-MM-DD", | ||
store="True", | ||
) | ||
|
||
cte40_natCarga = fields.One2many( | ||
related="document_id.fiscal_line_ids", | ||
) | ||
|
||
cte40_tarifa = fields.Many2one(comodel_name="l10n_br_cte.tarifa") | ||
|
||
def export_data(self): | ||
return { | ||
"cte40_dPrevAereo": self.cte40_dPrevAereo, | ||
"cte40_natCarga": {"cte40_xDime": self.cte40_natCarga.xDime}, | ||
"cte40_tarifa": { | ||
"cte40_CL": self.cte40_tarifa.cte40_CL, | ||
"cte40_vTar": self.cte40_tarifa.cte40_vTar, | ||
}, | ||
} | ||
|
||
|
||
class Tarifa(spec_models.SpecModel): | ||
_name = "l10n_br_cte.tarifa" | ||
_inherit = "cte.40.tarifa" | ||
|
||
cte40_CL = fields.Selection(related="CL", store=True) | ||
|
||
CL = fields.Selection( | ||
string="Classe", | ||
selection=[ | ||
("M", "Tarifa Mínima"), | ||
("G", "Tarifa Geral"), | ||
("E", "Tarifa Específica"), | ||
], | ||
store=True, | ||
default="G", | ||
) | ||
|
||
cte40_vTar = fields.Monetary(related="vTar") | ||
|
||
vTar = fields.Monetary(currency_field="brl_currency_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright 2023 KMEE INFORMATICA LTDA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields | ||
|
||
from odoo.addons.spec_driven_model.models import spec_models | ||
|
||
|
||
class Aquaviario(spec_models.SpecModel): | ||
_name = "l10n_br_cte.aquaviario" | ||
_inherit = "cte.40.aquav" | ||
|
||
document_id = fields.One2many( | ||
comodel_name="l10n_br_fiscal.document", inverse_name="cte40_aquav" | ||
) | ||
|
||
cte40_vPrest = fields.Monetary(compute="_compute_vPrest", store=True) | ||
|
||
cte40_vAFRMM = fields.Monetary(related="vAFRMM", store=True) | ||
|
||
vAFRMM = fields.Monetary( | ||
string="AFRMM", | ||
currency_field="brl_currency_id", | ||
help=("AFRMM (Adicional de Frete para Renovação da Marinha Mercante)"), | ||
store=True, | ||
) | ||
|
||
cte40_xNavio = fields.Char(related="xNavio", store=True) | ||
|
||
xNavio = fields.Char(string="Identificação do Navio", store=True) | ||
|
||
cte40_nViag = fields.Char(related="nViag", store=True) | ||
|
||
nViag = fields.Char(string="Número da Viagem", store=True) | ||
|
||
cte40_direc = fields.Selection(related="direc", store=True) | ||
|
||
direc = fields.Selection( | ||
selection=[ | ||
("N", "Norte, L-Leste, S-Sul, O-Oeste"), | ||
("S", "Sul, O-Oeste"), | ||
("L", "Leste, S-Sul, O-Oeste"), | ||
("O", "Oeste"), | ||
], | ||
string="Direção", | ||
store=True, | ||
help="Direção\nPreencher com: N-Norte, L-Leste, S-Sul, O-Oeste", | ||
) | ||
|
||
cte40_irin = fields.Char(related="irin", store=True) | ||
|
||
irin = fields.Char( | ||
string="Irin do navio sempre deverá", | ||
help="Irin do navio sempre deverá ser informado", | ||
store=True, | ||
) | ||
|
||
cte40_tpNav = fields.Selection(related="tpNav", store=True) | ||
|
||
tpNav = fields.Selection( | ||
selection=[ | ||
("0", "Interior"), | ||
("1", "Cabotagem"), | ||
], | ||
string="Tipo de Navegação", | ||
help=( | ||
"Tipo de Navegação\nPreencher com: \n\t\t\t\t\t\t0 - " | ||
"Interior;\n\t\t\t\t\t\t1 - Cabotagem" | ||
), | ||
store=True, | ||
) | ||
|
||
def _compute_vPrest(self): | ||
for record in self.document_id.fiscal_line_ids: | ||
record.cte40_vPrest += record.cte40_vTPrest | ||
|
||
def export_data(self): | ||
return { | ||
"cte40_vPrest": self.cte40_vPrest, | ||
"cte40_vAFRMM": self.cte40_vAFRMM, | ||
"cte40_xNavio": self.cte40_xNavio, | ||
"cte40_nViag": self.cte40_nViag, | ||
"cte40_direc": self.cte40_direc, | ||
"cte40_irin": self.cte40_irin, | ||
"cte40_tpNav": self.cte40_tpNav, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2023 KMEE INFORMATICA LTDA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields | ||
|
||
from odoo.addons.spec_driven_model.models import spec_models | ||
|
||
|
||
class Dutoviario(spec_models.SpecModel): | ||
_name = "l10n_br_cte.dutoviario" | ||
_inherit = ["cte.40.duto"] | ||
|
||
document_id = fields.One2many( | ||
comodel_name="l10n_br_fiscal.document", inverse_name="cte40_dutoviario" | ||
) | ||
|
||
cte40_dIni = fields.Date(related="dIni") | ||
|
||
dIni = fields.Date(string="Data de Início da prestação do serviço") | ||
|
||
cte40_dFim = fields.Date(related="dFim") | ||
|
||
dFim = fields.Date(string="Data de Fim da prestação do serviço") | ||
|
||
cte40_vTar = fields.Float(related="vTar") | ||
|
||
vTar = fields.Float(string="Valor da tarifa") | ||
|
||
def export_data(self): | ||
return { | ||
"cte40_dIni": self.cte40_dIni, | ||
"cte40_dFim": self.cte40_dFim, | ||
"cte40_vTar": self.cte40_vTar, | ||
} |
Oops, something went wrong.