Skip to content

Commit

Permalink
Merge PR #3339 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Sep 5, 2024
2 parents a1b0d85 + 00a930c commit e8755e4
Show file tree
Hide file tree
Showing 523 changed files with 4,983 additions and 3,140 deletions.
9 changes: 5 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 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
convert_readme_fragments_to_markdown: true
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
Expand All @@ -20,6 +21,6 @@ repo_description: Odoo Brazilian localization
repo_name: l10n-brazil
repo_slug: l10n-brazil
repo_website: https://github.com/OCA/l10n-brazil
use_pyproject_toml: false
use_ruff: false
use_pyproject_toml: true
use_ruff: true

12 changes: 0 additions & 12 deletions .flake8

This file was deleted.

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
13 changes: 0 additions & 13 deletions .isort.cfg

This file was deleted.

56 changes: 12 additions & 44 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ repos:
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/sbidoul/whool
rev: v0.5
hooks:
- id: whool-init
- 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 @@ -55,26 +59,13 @@ repos:
- --repo-name=l10n-brazil
- --if-source-changed
- --keep-source-digest
- --convert-fragments-to-markdown
- id: oca-gen-external-dependencies
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.25
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
- repo: https://github.com/myint/autoflake
rev: v1.6.1
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.8.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
Expand Down Expand Up @@ -116,35 +107,12 @@ repos:
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
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:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
args:
- --output
- requirements.txt
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==21.9.2"]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v9.1.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 = "py310"
fix = true

[lint]
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
"UP", # pyupgrade
]
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
46 changes: 28 additions & 18 deletions l10n_br_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Brazilian Localization Account

|badge1| |badge2| |badge3| |badge4| |badge5|

This module was written to extend the functionality of ... to support ...
and allow you to ...
This module was written to extend the functionality of ... to support
... and allow you to ...

**Table of contents**

Expand All @@ -41,21 +41,31 @@ Installation

To install this module, you need to:

* do this ...
- do this ...

Configuration
=============

To configure this module, you need to:

* go to ...
- go to ...

Usage
=====

To use this module, you need to:

* go to ...
- go to ...

Known issues / Roadmap
======================



Changelog
=========



Bug Tracker
===========
Expand All @@ -71,33 +81,33 @@ Credits
=======

Authors
~~~~~~~
-------

* Akretion

Contributors
~~~~~~~~~~~~
------------

* `Akretion <https://akretion.com/pt-BR>`_:
- `Akretion <https://akretion.com/pt-BR>`__:

* Renato Lima <renato.lima@akretion.com.br>
* Raphaël Valyi <raphael.valyi@akretion.com.br>
- Renato Lima <renato.lima@akretion.com.br>
- Raphaël Valyi <raphael.valyi@akretion.com.br>

* `KMEE <https://www.kmee.com.br>`_:
- `KMEE <https://www.kmee.com.br>`__:

* Luis Felipe Mileo <mileo@kmee.com.br>
- Luis Felipe Mileo <mileo@kmee.com.br>

* `Escodoo <https://www.escodoo.com.br>`_:
- `Escodoo <https://www.escodoo.com.br>`__:

* Marcel Savegnago <marcel.savegnago@escodoo.com.br>
- Marcel Savegnago <marcel.savegnago@escodoo.com.br>

* `Engenere <https://engenere.one>`_:
- `Engenere <https://engenere.one>`__:

* Antônio S. Pereira Neto <neto@engenere.one>
* Felipe Motter Pereira <felipe@engenere.one>
- Antônio S. Pereira Neto <neto@engenere.one>
- Felipe Motter Pereira <felipe@engenere.one>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

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
15 changes: 9 additions & 6 deletions l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,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 @@ -199,7 +200,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_%s" % (field,)] = vals[field]
vals[f"fiscal_{field}"] = vals[field]

def ensure_one_doc(self):
self.ensure_one()
Expand Down Expand Up @@ -257,8 +258,10 @@ def _get_view(self, view_id=None, view_type="form", **options):
for sub_form_node in arch.xpath("//field[@name='line_ids']/tree"):
self.env["account.move.line"].inject_fiscal_fields(sub_form_node)
# TODO kanban??
# for sub_form_node in arch.xpath("//field[@name='line_ids']/kanban"):
# self.env["account.move.line"].inject_fiscal_fields(sub_form_node)
# for sub_form_node in arch.xpath(
# "//field[@name='line_ids']/kanban"):
# self.env["account.move.line"].inject_fiscal_fields(
# sub_form_node)
#

return arch, view
Expand Down Expand Up @@ -428,10 +431,10 @@ def _sync_dynamic_lines(self, container):

def update_payment_term_number(self):
payment_term_lines = self.line_ids.filtered(
lambda l: l.display_type == "payment_term"
lambda line: line.display_type == "payment_term"
)
payment_term_lines_sorted = payment_term_lines.sorted(
key=lambda l: l.date_maturity
key=lambda line: line.date_maturity
)
for idx, line in enumerate(payment_term_lines_sorted, start=1):
line.with_context(skip_invoice_sync=True).write(
Expand Down
13 changes: 7 additions & 6 deletions l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class AccountMoveLine(models.Model):
)

payment_term_number = fields.Char(
help="Stores the installment number in the format 'current-total'. For example, "
"'1-3' for the first of three installments, '2-3' for the second, and '3-3'"
" for the last installment.",
help="Stores the installment number in the format 'current-total'. "
"For example, '1-3' for the first of three installments, '2-3' for the second,"
" and '3-3' for the last installment.",
)

@api.depends(
Expand Down Expand Up @@ -169,7 +169,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_%s" % (field,)] = vals[field]
vals[f"fiscal_{field}"] = vals[field]

@api.model_create_multi
def create(self, vals_list):
Expand Down Expand Up @@ -239,7 +239,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 Down Expand Up @@ -285,7 +286,7 @@ def existing():
.with_context(
skip_invoice_line_sync=True,
)
.filtered(lambda l: l.move_id.is_invoice(True))
.filtered(lambda line: line.move_id.is_invoice(True))
}

def changed(fname):
Expand Down
8 changes: 4 additions & 4 deletions l10n_br_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ 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: t.id == account_tax.get("id")) # noqa: B023
fiscal_tax = fiscal_taxes_results["taxes"].get(
account_taxes_by_domain.get(tax.id)
)
Expand Down Expand Up @@ -271,10 +271,10 @@ def _compute_taxes_for_single_line(
handle_price_include=base_line["handle_price_include"],
include_caba_tags=include_caba_tags,
)
for tax_res, new_taxes_res in zip(
taxes_res["taxes"], new_taxes_res["taxes"]
for tax_res, _new_taxes_res in zip(
taxes_res["taxes"], new_taxes_res["taxes"], strict=True
):
delta_tax = new_taxes_res["amount"] - tax_res["amount"]
delta_tax = _new_taxes_res["amount"] - tax_res["amount"]
tax_res["amount"] += delta_tax
to_update_vals["price_total"] += delta_tax

Expand Down
Loading

0 comments on commit e8755e4

Please sign in to comment.