Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] l10n_br_account_payment_brcobranca: espécie da moeda e documento impresso no boleto #2966

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

from odoo import fields, models

from odoo.addons.l10n_br_account_payment_order.constants import (
get_boleto_especie_short_name,
)

from ..constants.br_cobranca import DICT_BRCOBRANCA_CURRENCY, get_brcobranca_bank

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -68,7 +72,10 @@ def send_payment(self):
"documento_numero": move_line.document_number,
"data_vencimento": move_line.date_maturity.strftime("%Y/%m/%d"),
"data_documento": move_line.move_id.invoice_date.strftime("%Y/%m/%d"),
"especie": move_line.payment_mode_id.boleto_species,
"especie": move_line.currency_id.symbol,
"especie_documento": get_boleto_especie_short_name(
move_line.payment_mode_id.boleto_species
),
"moeda": DICT_BRCOBRANCA_CURRENCY["R$"],
"aceite": move_line.payment_mode_id.boleto_accept,
"sacado_endereco": (move_line.partner_id.street_name or "")
Expand Down
43 changes: 29 additions & 14 deletions l10n_br_account_payment_order/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,22 +480,37 @@
]

BOLETO_ESPECIE = [
("01", "DUPLICATA MERCANTIL"),
("02", "NOTA PROMISSÓRIA"),
("03", "NOTA DE SEGURO"),
("04", "MENSALIDADE ESCOLAR"),
("05", "RECIBO"),
("06", "CONTRATO"),
("07", "COSSEGUROS"),
("08", "DUPLICATA DE SERVIÇO"),
("09", "LETRA DE CÂMBIO"),
("13", "NOTA DE DÉBITOS"),
("15", "DOCUMENTO DE DÍVIDA"),
("16", "ENCARGOS CONDOMINIAIS"),
("17", "CONTA DE PRESTAÇÃO DE SERVIÇOS"),
("99", "DIVERSOS"),
# CODE, DESCRIPTION, SHORT NAME
("01", "DUPLICATA MERCANTIL", "DM"),
("02", "NOTA PROMISSÓRIA", "NP"),
("03", "NOTA DE SEGURO", "NS"),
("04", "MENSALIDADE ESCOLAR", "ME"),
("05", "RECIBO", "REC"),
("06", "CONTRATO", "CONT"),
("07", "COSSEGUROS", "COSSEG"),
("08", "DUPLICATA DE SERVIÇO", "DS"),
("09", "LETRA DE CÂMBIO", "LC"),
("13", "NOTA DE DÉBITOS", "ND"),
("15", "DOCUMENTO DE DÍVIDA", "DD"),
("16", "ENCARGOS CONDOMINIAIS", "EC"),
("17", "CONTA DE PRESTAÇÃO DE SERVIÇOS", "CPS"),
("99", "DIVERSOS", "DIV"),
]


def get_boleto_especies():
# return the list of "boleto especie" only code and description
return [(code, desc) for code, desc, _ in BOLETO_ESPECIE]


def get_boleto_especie_short_name(selected_code):
# return the short name of "boleto especie"
for code, _, short_name in BOLETO_ESPECIE:
if code == selected_code:
return short_name
return None

Check warning on line 511 in l10n_br_account_payment_order/constants.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account_payment_order/constants.py#L511

Added line #L511 was not covered by tests


STATE_CNAB = [
("draft", "Novo"),
("done", "Processado"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from odoo import fields, models

from ..constants import BOLETO_ESPECIE
from ..constants import get_boleto_especies


class L10nBrCNABBoletoFields(models.AbstractModel):
Expand Down Expand Up @@ -99,7 +99,7 @@ class L10nBrCNABBoletoFields(models.AbstractModel):
)

boleto_species = fields.Selection(
selection=BOLETO_ESPECIE,
selection=get_boleto_especies(),
string="Espécie do Título",
default="01",
tracking=True,
Expand Down
Loading