Skip to content

Commit

Permalink
Merge PR #2749 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Oct 27, 2023
2 parents e2ae98f + c89a428 commit cb4f086
Show file tree
Hide file tree
Showing 101 changed files with 2 additions and 168 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def compute_all(
sum_repartition_factor = sum(tax_repartition_lines.mapped("factor"))

if fiscal_tax:

if fiscal_tax.get("base") < 0:
sign = -1
fiscal_tax["base"] = -fiscal_tax.get("base")
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account/report/account_invoice_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class AccountInvoiceReport(models.Model):

_inherit = "account.invoice.report"

issuer = fields.Selection(
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_nfe/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def load_simples_nacional_demo(env, registry):
"l10n_br_base.empresa_simples_nacional", raise_if_not_found=False
)
if company_sn:

# Allow all companies for OdooBot user and set default user company
companies = env["res.company"].search([])
env.user.company_ids = [(6, 0, companies.ids)]
Expand Down
3 changes: 0 additions & 3 deletions l10n_br_account_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class DocumentNfe(models.Model):

_inherit = "l10n_br_fiscal.document"

##########################
Expand Down Expand Up @@ -101,7 +100,6 @@ def _compute_nfe40_detpag(self):
for field in det_pag_vals
}
if det_pag_vals != detpag_current:

rec.nfe40_detPag = [(2, detpag, 0) for detpag in rec.nfe40_detPag.ids]
rec.nfe40_detPag = [(0, 0, det_pag_vals)]

Expand Down Expand Up @@ -142,7 +140,6 @@ def _is_without_payment(self):
@api.constrains("nfe40_detPag", "state_edoc")
def _check_fiscal_payment_mode(self):
for rec in self:

if (
rec.state_edoc == "em_digitacao"
or not rec._need_compute_nfe_tags()
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_nfe/models/leiauteNFe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class DetPag(models.AbstractModel):

_inherit = "nfe.40.detpag"

nfe40_indPag = fields.Selection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def multi_move_import(self, file_stream, ftype="csv"):
return res_cnab_log

def _move_import(self, parser, file_stream, result_row_list=None, ftype="csv"):

# Overwrite this method to create the CNAB Return Log and change
# the warning message when the file don't has any line to create
# the Journal Entry, because in CNAB exist the case where
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_payment_brcobranca/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def generate_boleto_pdf(self):
)

def _get_brcobranca_boleto(self, boletos):

content = json.dumps(boletos)
f = open(tempfile.mktemp(), "w")
f.write(content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ class AccountMoveLine(models.Model):
# brcobranca/boleto/itau_spec.rb

def send_payment(self):

# super(AccountMoveLine, self).send_payment()
wrapped_boleto_list = []

for move_line in self:

bank_account_id = move_line.payment_mode_id.fixed_journal_id.bank_account_id
bank_name_brcobranca = get_brcobranca_bank(
bank_account_id, move_line.payment_mode_id.payment_method_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def _prepare_remessa_unicred_400(self, remessa_values):
remessa_values["codigo_beneficiario"] = int(self.payment_mode_id.code_convetion)

def _prepare_remessa_sicredi_240(self, remessa_values):

bank_account_id = self.journal_id.bank_account_id
remessa_values.update(
{
Expand Down Expand Up @@ -163,7 +162,6 @@ def generate_payment_file(self):
return remessa, self.get_file_name(cnab_type)

def _get_brcobranca_remessa(self, bank_brcobranca, remessa_values, cnab_type):

content = json.dumps(remessa_values)
f = open(tempfile.mktemp(), "w")
f.write(content)
Expand Down
7 changes: 0 additions & 7 deletions l10n_br_account_payment_brcobranca/parser/cnab_file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def parser_for(cls, parser_name):
return parser_name == "cnab240"

def parse(self, filebuffer):

files = {"data": base64.b64decode(filebuffer)}

data = self._get_brcobranca_retorno(files)
Expand All @@ -76,7 +75,6 @@ def parse(self, filebuffer):
yield self.result_row_list

def _get_brcobranca_retorno(self, files):

bank_name_brcobranca = dict_brcobranca_bank[self.bank.code_bc]
brcobranca_api_url = get_brcobranca_api_url(self.env)
# Ex.: "http://boleto_cnab_api:9292/api/retorno"
Expand Down Expand Up @@ -118,7 +116,6 @@ def _get_date_format(self, bank_name_brcobranca):
return zeros_date, date_format

def process_return_file(self, data):

# Forma de Lançamento do Retorno
# Em caso de Pagamento/Liquidação é feita a criação de uma Entrada de
# Diário para cada linha do arquivo CNAB com os valores de desconto,
Expand Down Expand Up @@ -199,7 +196,6 @@ def process_return_file(self, data):
registration_code_allowed = 1

for linha_cnab in data:

if int(linha_cnab["codigo_registro"]) != registration_code_allowed:
# Bradesco
# Existe o codigo de registro 9 que eh um totalizador
Expand Down Expand Up @@ -338,7 +334,6 @@ def process_return_file(self, data):
linha_cnab.get("data_vencimento")
and linha_cnab.get("data_vencimento") != zeros_date
):

due_date = datetime.datetime.strptime(
str(linha_cnab.get("data_vencimento")), date_format
).date()
Expand Down Expand Up @@ -367,7 +362,6 @@ def process_return_file(self, data):

# Caso de Pagamento deve criar os Lançamentos de Diário
if cod_ocorrencia in cnab_liq_move_code:

row_list, log_event_payment = self._get_accounting_entries(
linha_cnab, account_move_line, payment_lines
)
Expand Down Expand Up @@ -473,7 +467,6 @@ def _get_accounting_entries(self, linha_cnab, account_move_line, payment_lines):
valor_juros_mora = self.cnab_str_to_float(linha_cnab["juros_mora"])

if valor_juros_mora > 0.0:

row_list.append(
{
"name": "Valor Juros Mora (boleto) "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def setUpClass(cls):
}

def _run_boleto_remessa(self, invoice, boleto_file, remessa_file):

# I validate invoice
invoice.action_post()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def _import_file(self, file_name):
return self.account_move_obj.browse(action["res_id"])

def test_valor_menor_1(self):

mocked_response = [
{
"codigo_registro": "1",
Expand Down Expand Up @@ -282,7 +281,6 @@ def test_valor_menor_1(self):
self.assertEqual("Banco UNICRED - Conta 371", log.name)

def test_valor_menor_2(self):

mocked_response = [
{
"codigo_registro": "1",
Expand Down Expand Up @@ -435,7 +433,6 @@ def test_valor_menor_2(self):
self.assertEqual(self.invoice_unicred_1.payment_state, "paid")

def test_valor_maior_3(self):

mocked_response = [
{
"codigo_registro": "1",
Expand Down Expand Up @@ -586,7 +583,6 @@ def test_valor_maior_3(self):
self.assertEqual("Banco UNICRED - Conta 371", log.name)

def test_valor_maior_4(self):

mocked_response = [
{
"codigo_registro": "1",
Expand Down Expand Up @@ -739,7 +735,6 @@ def test_valor_maior_4(self):
self.assertEqual(self.invoice_unicred_2.payment_state, "paid")

def test_ailos_return(self):

mocked_response = [
{
"codigo_registro": "03",
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_payment_order/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class AccountJournal(models.Model):

_inherit = "account.journal"

bank_code_bc = fields.Char(related="bank_id.code_bc")
1 change: 0 additions & 1 deletion l10n_br_account_payment_order/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def load_cnab_info(self):
filtered_invoice_ids.create_account_payment_line()

def unlink(self):

# Verificar se é necessário solicitar a Baixa no caso de CNAB
cnab_already_start = False
for l_aml in self.mapped("line_ids"):
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_payment_order/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def create_payment_line_from_move_line(self, payment_order):
:return:
"""
for record in self:

cnab_state = "added"
if record.reconciled:
cnab_state = "added_paid"
Expand Down
1 change: 0 additions & 1 deletion l10n_br_account_payment_order/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class AccountPayment(models.Model):
_inherit = "account.payment"

def action_post(self):

for record in self:
if (
record.payment_method_code in BR_CODES_PAYMENT_ORDER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def _cnab_already_start(self):
return result

def update_cnab_for_cancel_invoice(self):

cnab_already_start = self._cnab_already_start()
if cnab_already_start:
reason_write_off = (
Expand Down
1 change: 0 additions & 1 deletion l10n_br_base/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _check_cnpj_inscr_est(self):
def _check_cnpj_cpf(self):
result = True
for record in self:

disable_cnpj_ie_validation = record.env[
"ir.config_parameter"
].sudo().get_param(
Expand Down
6 changes: 0 additions & 6 deletions l10n_br_cnab_structure/cnab/cnab.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class RecordType(Enum):


class CnabField:

__slots__ = ["position", "value", "name"]

def __init__(self, position: int, value: str, name: str = "") -> None:
Expand All @@ -26,7 +25,6 @@ def __init__(self, position: int, value: str, name: str = "") -> None:


class CnabLine:

type: RecordType
fields: List[CnabField]

Expand Down Expand Up @@ -54,12 +52,10 @@ def output(self) -> str:
return "".join(self.sorted_values().values())

def asdict(self):

return {"type": self.type.name, "fields": self.sorted_values()}


class CnabDetailRecord:

segments: List[CnabLine]

def __init__(self, name: str) -> None:
Expand All @@ -80,7 +76,6 @@ def asdict(self):


class CnabBatch:

header: CnabLine
detail_records: List[CnabDetailRecord]
trailer: CnabLine
Expand Down Expand Up @@ -116,7 +111,6 @@ def asdict(self):


class Cnab:

header: CnabLine
batches: List[CnabBatch]
trailer: CnabLine
Expand Down
1 change: 0 additions & 1 deletion l10n_br_cnab_structure/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class AccountJournal(models.Model):

_inherit = "account.journal"

used_to_import_cnab = fields.Boolean(string="Journal used for import CNAB")
Expand Down
2 changes: 0 additions & 2 deletions l10n_br_cnab_structure/models/cnab_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class CNABBatch(models.Model):

_name = "l10n_br_cnab.batch"
_description = "A batch of lines in a CNAB structure."

Expand Down Expand Up @@ -110,7 +109,6 @@ def unlink(self):
return super(CNABBatch, self).unlink()

def check_batch(self):

if self.cnab_structure_id.cnab_format != "240":
raise UserError(
_(f"{self.name}: A batch must belong to a CNAB 240 structure!")
Expand Down
2 changes: 0 additions & 2 deletions l10n_br_cnab_structure/models/cnab_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class CNABLine(models.Model):

_name = "l10n_br_cnab.line"
_description = "Lines that make up the CNAB."
_order = "sequence, id"
Expand Down Expand Up @@ -225,7 +224,6 @@ def unlink(self):
return super(CNABLine, self).unlink()

def check_line(self):

cnab_fields = self.field_ids.sorted(key=lambda r: r.start_pos)

if len(cnab_fields) == 0:
Expand Down
1 change: 0 additions & 1 deletion l10n_br_cnab_structure/models/cnab_line_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class CNABField(models.Model):

_name = "l10n_br_cnab.line.field"
_description = "Fields in CNAB lines."
_order = "cnab_line_id, start_pos"
Expand Down
2 changes: 0 additions & 2 deletions l10n_br_cnab_structure/models/cnab_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class CNABStructure(models.Model):

_name = "l10n_br_cnab.structure"
_description = (
"An structure with header, body and trailer that make up the CNAB structure."
Expand Down Expand Up @@ -363,7 +362,6 @@ def action_draft(self):
self.write({"state": "draft"})

def check_structure(self):

for line in self.line_ids:
line.check_line()

Expand Down
1 change: 0 additions & 1 deletion l10n_br_cnab_structure/models/l10n_br_cnab_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class CNABReturnEvent(models.Model):

_inherit = "l10n_br_cnab.return.event"

# BASE FIELDS #
Expand Down
1 change: 0 additions & 1 deletion l10n_br_cnab_structure/models/l10n_br_cnab_return_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class L10nBrCNABReturnLog(models.Model):

_inherit = "l10n_br_cnab.return.log"

journal_id = fields.Many2one(
Expand Down
1 change: 0 additions & 1 deletion l10n_br_cnab_structure/tests/test_cnab_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ def test_cnab_structure_states(self):
self.assertEqual(cnab_structure.state, "draft")

def test_field_select_wizard(self):

cnab_field_id = self._create_valid_cnab_structure().line_ids[0].field_ids[0]
wiz_action = cnab_field_id.action_change_field_sending()

Expand Down
Loading

0 comments on commit cb4f086

Please sign in to comment.