Skip to content

Commit

Permalink
Merge branch '14.0' into 14.0-send-email
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo authored Sep 26, 2024
2 parents 14a8457 + 52a62b9 commit 6218d3e
Show file tree
Hide file tree
Showing 275 changed files with 4,063 additions and 3,708 deletions.
5 changes: 3 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.21.1
_commit: v1.24
_src_path: gh:oca/oca-addons-repo-template
additional_ruff_rules: []
ci: GitHub
convert_readme_fragments_to_markdown: false
generate_requirements_txt: true
Expand All @@ -26,5 +27,5 @@ repo_name: Odoo Brazilian Localization / Localização brasileira do Odoo
repo_slug: l10n-brazil
repo_website: https://github.com/OCA/l10n-brazil
use_pyproject_toml: false
use_ruff: false
use_ruff: true

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ var/
*.egg
*.eggs

# Debian packages
*.deb

# Redhat packages
*.rpm

# MacOS packages
*.dmg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
35 changes: 6 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
rev: d5fab7ee87fceee858a3d01048c78a548974d935
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand All @@ -64,21 +64,6 @@ repos:
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args:
- --expand-star-imports
- --ignore-init-module-imports
- --in-place
- --remove-all-unused-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.1.2
hooks:
Expand Down Expand Up @@ -125,14 +110,6 @@ repos:
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py
args:
- --settings=.
exclude: /__init__\.py$
- repo: https://github.com/acsone/setuptools-odoo
rev: 3.1.8
hooks:
Expand All @@ -143,12 +120,12 @@ repos:
- requirements.txt
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==20.1.4"]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: 7.0.2
hooks:
Expand Down
30 changes: 30 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

target-version = "py39"

fix = true

[lint]
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
]
exclude = ["setup/*"]

[format]
exclude = ["setup/*"]

[per-file-ignores]
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
"__manifest__.py" = ["B018"] # useless expression

[isort]
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]

[isort.sections]
"odoo" = ["odoo"]
"odoo-addons" = ["odoo.addons"]

[mccabe]
max-complexity = 16
42 changes: 0 additions & 42 deletions .t2d.yml

This file was deleted.

70 changes: 35 additions & 35 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion l10n_br_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Invoicing and accounting entries for Brazil
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e4d30ba98d64e3c2b52a8b98d2de72e89b0be60f7cea41d4e0380c7c4906b74c
!! source digest: sha256:d1ce2adba05ba7964976b98170faeea30e9e43a5992253ce28f966307ed7da7b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "AGPL-3",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"version": "14.0.11.13.1",
"version": "14.0.11.13.3",
"development_status": "Beta",
"maintainers": ["renatonlima", "rvalyi"],
"depends": [
Expand Down
6 changes: 6 additions & 0 deletions l10n_br_account/i18n/l10n_br_account.pot
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ msgstr ""
msgid "COFINS ST CST Code"
msgstr ""

#. module: l10n_br_account
#: code:addons/l10n_br_account/models/document.py:0
#, python-format
msgid "Canceled due to the denial of document %(document_number)s"
msgstr ""

#. module: l10n_br_account
#: code:addons/l10n_br_account/models/account_move.py:0
#, python-format
Expand Down
10 changes: 8 additions & 2 deletions l10n_br_account/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-07 09:02+0000\n"
"PO-Revision-Date: 2024-07-19 04:58+0000\n"
"Last-Translator: Antônio Neto <netosjb@yahoo.com.br>\n"
"PO-Revision-Date: 2024-09-26 14:06+0000\n"
"Last-Translator: Marcel Savegnago <marcel.savegnago@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -134,6 +134,12 @@ msgstr "Código CST de COFINS"
msgid "COFINS ST CST Code"
msgstr "Código CST ST COFINS"

#. module: l10n_br_account
#: code:addons/l10n_br_account/models/document.py:0
#, python-format
msgid "Canceled due to the denial of document %(document_number)s"
msgstr "Cancelado devido à negação do documento %(document_number)s"

#. module: l10n_br_account
#: code:addons/l10n_br_account/models/account_move.py:0
#, python-format
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account/models/account_incoterms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def name_get(self):
# name completo
if len(record.name) > 150:
name = record.name[:150] + " ..."
result.append((record.id, "%s - %s" % (record.code, name)))
result.append((record.id, f"{record.code} - {name}"))
return result
8 changes: 5 additions & 3 deletions l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def _check_fiscal_document_type(self):
if rec.document_type_id and not rec.fiscal_document_id:
raise UserError(
_(
"You cannot set a document type when the move has no Fiscal Document!"
"You cannot set a document type when the move has no Fiscal "
"Document!"
)
)

Expand Down Expand Up @@ -174,7 +175,7 @@ def _inject_shadowed_fields(self, vals_list):
for vals in vals_list:
for field in self._shadowed_fields():
if field in vals:
vals["fiscal_proxy_%s" % (field,)] = vals[field]
vals[f"fiscal_proxy_{field}"] = vals[field]

def ensure_one_doc(self):
self.ensure_one()
Expand Down Expand Up @@ -242,7 +243,8 @@ def fields_view_get(

if invoice_view["fields"].get("line_ids"):
# it is required to inject the fiscal fields in the
# "accounting lines" view to avoid loosing fiscal values from the form.
# "accounting lines" view to avoid loosing fiscal values from the
# form.
sub_form_view = invoice_view["fields"]["line_ids"]["views"]["tree"][
"arch"
]
Expand Down
9 changes: 5 additions & 4 deletions l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _inject_shadowed_fields(self, vals_list):
for vals in vals_list:
for field in self._shadowed_fields():
if field in vals:
vals["fiscal_proxy_%s" % (field,)] = vals[field]
vals[f"fiscal_proxy_{field}"] = vals[field]

@api.model_create_multi
def create(self, vals_list):
Expand Down Expand Up @@ -247,7 +247,8 @@ def create(self, vals_list):
# Initialize the inverted index list with the same length as the original list
inverted_index = [0] * len(original_indexes)

# Iterate over the original_indexes list and fill the inverted_index list accordingly
# Iterate over the original_indexes list and fill the inverted_index list
# accordingly
for i, val in enumerate(original_indexes):
inverted_index[val] = i

Expand All @@ -257,8 +258,8 @@ def create(self, vals_list):
sorted_result |= result[idx]

for line in sorted_result:
# Forces the recalculation of price_total and price_subtotal fields which are
# recalculated by super
# Forces the recalculation of price_total and price_subtotal fields which
# are recalculated by super
if line.move_id.company_id.country_id.code == "BR":
line.update(line._get_price_total_and_subtotal())

Expand Down
4 changes: 3 additions & 1 deletion l10n_br_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def compute_all(
account_taxes_by_domain.update({tax.id: tax_domain})

for account_tax in taxes_results["taxes"]:
tax = self.filtered(lambda t: t.id == account_tax.get("id"))
tax = self.filtered(
lambda t, account_tax=account_tax: t.id == account_tax.get("id")
)
fiscal_tax = fiscal_taxes_results["taxes"].get(
account_taxes_by_domain.get(tax.id)
)
Expand Down
33 changes: 27 additions & 6 deletions l10n_br_account/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from odoo.exceptions import UserError

from odoo.addons.l10n_br_fiscal.constants.fiscal import (
DOCUMENT_ISSUER_COMPANY,
DOCUMENT_ISSUER_PARTNER,
MODELO_FISCAL_CTE,
MODELO_FISCAL_NFE,
SITUACAO_EDOC_EM_DIGITACAO,
)

Expand Down Expand Up @@ -123,10 +126,10 @@ def unlink(self):
@api.model_create_multi
def create(self, vals_list):
"""
It's not allowed to create a fiscal document line without a document_type_id anyway.
But instead of letting Odoo crash in this case we simply avoid creating the
record. This makes it possible to create an account.move without
a fiscal_document_id despite the _inherits system:
It's not allowed to create a fiscal document line without a document_type_id
anyway. But instead of letting Odoo crash in this case we simply avoid creating
the record. This makes it possible to create an account.move without a
fiscal_document_id despite the _inherits system:
Odoo will write NULL as the value in this case.
"""
if self._context.get("create_from_move"):
Expand Down Expand Up @@ -158,17 +161,25 @@ def cancel_move_ids(self):

def _document_cancel(self, justificative):
result = super()._document_cancel(justificative)
msg = "Cancelamento: {}".format(justificative)
msg = f"Cancelamento: {justificative}"
self.cancel_move_ids()
self.message_post(body=msg)
return result

def _document_correction(self, justificative):
result = super()._document_correction(justificative)
msg = "Carta de correção: {}".format(justificative)
msg = f"Carta de correção: {justificative}"
self.message_post(body=msg)
return result

def _document_deny(self):
msg = _(
"Canceled due to the denial of document %(document_number)s",
document_number=self.document_number,
)
self.cancel_move_ids()
self.message_post(body=msg)

def action_document_confirm(self):
result = super().action_document_confirm()
if not self._context.get("skip_post"):
Expand All @@ -186,3 +197,13 @@ def _edoc_subscribe(self):
if self.move_ids:
self.move_ids._edoc_subscribe()
return

Check warning on line 199 in l10n_br_account/models/document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/document.py#L198-L199

Added lines #L198 - L199 were not covered by tests

def exec_after_SITUACAO_EDOC_DENEGADA(self, old_state, new_state):
self.ensure_one()
models_cancel_on_deny = [MODELO_FISCAL_NFE, MODELO_FISCAL_CTE]
if (
self.document_type_id.code in models_cancel_on_deny
and self.issuer == DOCUMENT_ISSUER_COMPANY
):
self._document_deny()
return super().exec_after_SITUACAO_EDOC_DENEGADA(old_state, new_state)
2 changes: 1 addition & 1 deletion l10n_br_account/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Invoicing and accounting entries for Brazil</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e4d30ba98d64e3c2b52a8b98d2de72e89b0be60f7cea41d4e0380c7c4906b74c
!! source digest: sha256:d1ce2adba05ba7964976b98170faeea30e9e43a5992253ce28f966307ed7da7b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account"><img alt="OCA/l10n-brazil" src="https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of … to support …
Expand Down
Loading

0 comments on commit 6218d3e

Please sign in to comment.