diff --git a/.copier-answers.yml b/.copier-answers.yml
index c4d941a1..ff0564a2 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,8 +1,8 @@
# Do NOT update manually; changes here will be overwritten by Copier
-_commit: v1.17.1
+_commit: v1.22
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
-dependency_installation_mode: PIP
+convert_readme_fragments_to_markdown: false
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
@@ -20,6 +20,6 @@ repo_description: 'TODO: add repo description.'
repo_name: budgeting
repo_slug: budgeting
repo_website: https://github.com/ecosoft-odoo/budgeting
-travis_apt_packages: []
-travis_apt_sources: []
+use_pyproject_toml: false
+use_ruff: false
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 2350a0f7..745e3bbd 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -15,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- 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
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 1693a125..fa17fcd4 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Stale PRs and issues policy
- uses: actions/stale@v4
+ uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# General settings.
@@ -48,7 +48,7 @@ jobs:
# * Issues that are pending more information
# * Except Issues marked as "no stale"
- name: Needs more information stale issues policy
- uses: actions/stale@v4
+ uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
ascending: true
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a75bfcdb..021189ee 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -53,4 +53,19 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- - uses: codecov/codecov-action@v1
+ - name: Install addons and dependencies
+ run: oca_install_addons
+ - name: Check licenses
+ run: manifestoo -d . check-licenses
+ - name: Check development status
+ run: manifestoo -d . check-dev-status --default-dev-status=Beta
+ - name: Initialize test db
+ run: oca_init_test_database
+ # - name: Run tests
+ # run: oca_run_tests
+ # - uses: codecov/codecov-action@v4
+ # with:
+ # token: ${{ secrets.CODECOV_TOKEN }}
+ # - name: Update .pot files
+ # run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
+ # if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'OCA' }}
diff --git a/.gitignore b/.gitignore
index 9c283fd4..0090721f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
/.venv
/.pytest_cache
+/.ruff_cache
# C extensions
*.so
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ba7e0ab9..3e251db8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,6 +14,10 @@ exclude: |
^docs/_templates/.*\.html$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
+ # Ignore build and dist directories in addons
+ /build/|/dist/|
+ # Ignore test files in addons
+ /tests/samples/.*|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
@@ -35,7 +39,7 @@ repos:
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
- rev: 969238e47c07d0c40573acff81d170f63245d738
+ rev: 9a170331575a265c092ee6b24b845ec508e8ef75
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
@@ -48,6 +52,7 @@ repos:
- --org-name=ecosoft-odoo
- --repo-name=budgeting
- --if-source-changed
+ - --keep-source-digest
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.25
hooks:
@@ -139,7 +144,7 @@ repos:
name: flake8
additional_dependencies: ["flake8-bugbear==21.9.2"]
- repo: https://github.com/OCA/pylint-odoo
- rev: 7.0.2
+ rev: 7.0.5
hooks:
- id: pylint_odoo
name: pylint with optional checks
diff --git a/budget_allocation/models/base_budget_move.py b/budget_allocation/models/base_budget_move.py
index 2218d5f2..1b048425 100644
--- a/budget_allocation/models/base_budget_move.py
+++ b/budget_allocation/models/base_budget_move.py
@@ -117,8 +117,12 @@ def check_budget_allocation_limit(self, doclines):
query_dict = self._get_query_dict(docline)
if not any(x["amount_type"] == "1_budget" for x in query_dict):
errors.append(
- _("{} & {} & {} is not allocated on budget allocation").format(
- name, fund_name, tag_name or "False"
+ _(
+ "%(name)s & %(fund_name)s & %(tag_name)s is not allocated "
+ "on budget allocation",
+ name=name,
+ fund_name=fund_name,
+ tag_name=tag_name or "False",
)
)
continue
@@ -140,8 +144,12 @@ def check_budget_allocation_limit(self, doclines):
if float_compare(total_spend, 0.0, precision_digits=prec_digits) == -1:
errors.append(
_(
- "{} & {} & {} spend amount over budget allocation limit {:,.2f}"
- ).format(name, fund_name, tag_name or "False", total_spend)
+ "%(name)s & %(fund_name)s & %(tag_name)s spend amount "
+ "over budget allocation limit {:,.2f}",
+ name=name,
+ fund_name=fund_name,
+ tag_name=tag_name or "False",
+ ).format(total_spend)
)
return errors
diff --git a/budget_allocation/models/budget_transfer_item.py b/budget_allocation/models/budget_transfer_item.py
index fc57e842..0d5aea33 100644
--- a/budget_allocation/models/budget_transfer_item.py
+++ b/budget_allocation/models/budget_transfer_item.py
@@ -308,13 +308,12 @@ def transfer(self):
allocation_lines = rec.allocation_line_from_ids + rec.allocation_line_to_ids
budget_allocation_ids = allocation_lines.mapped("budget_allocation_id")
message = _(
- "{}
transfer to
{}
with amount {:,.2f} {}"
- ).format(
- rec._get_message_transfer_from(),
- rec._get_message_transfer_to(),
- rec.amount,
- self.env.company.currency_id.symbol,
- )
+ "%(message_from)s
transfer to
%(message_to)s"
+ "
with amount {:,.2f} %(symbol)s",
+ message_from=rec._get_message_transfer_from(),
+ message_to=rec._get_message_transfer_to(),
+ symbol=self.env.company.currency_id.symbol,
+ ).format(rec.amount)
budget_allocation_ids.message_post(body=message)
return res
@@ -329,12 +328,11 @@ def reverse(self):
allocation_lines = rec.allocation_line_from_ids + rec.allocation_line_to_ids
budget_allocation_ids = allocation_lines.mapped("budget_allocation_id")
message = _(
- "{}
reverse from
{}
with amount {:,.2f} {}"
- ).format(
- rec._get_message_transfer_from(),
- rec._get_message_transfer_to(),
- rec.amount,
- self.env.company.currency_id.symbol,
- )
+ "%(message_from)s
reverse from
%(message_to)s"
+ "
with amount {:,.2f} %(symbol)s",
+ message_from=rec._get_message_transfer_from(),
+ message_to=rec._get_message_transfer_to(),
+ symbol=self.env.company.currency_id.symbol,
+ ).format(rec.amount)
budget_allocation_ids.message_post(body=message)
return res
diff --git a/budget_control/models/budget_control.py b/budget_control/models/budget_control.py
index afc164a0..b0162139 100644
--- a/budget_control/models/budget_control.py
+++ b/budget_control/models/budget_control.py
@@ -241,9 +241,10 @@ def _check_budget_control_over_consumed(self):
)
if budget_info["amount_balance"] < 0:
raise UserError(
- _("Total amount in KPI {} will result in {:,.2f}").format(
- line.name, budget_info["amount_balance"]
- )
+ _(
+ "Total amount in KPI %(name)s will result in {:,.2f}",
+ name=line.name,
+ ).format(budget_info["amount_balance"])
)
@api.onchange("use_all_kpis")
@@ -365,8 +366,10 @@ def _check_budget_amount(self):
):
raise UserError(
_(
- "Planning amount should equal to the released amount {:,.2f} {}"
- ).format(rec.released_amount, rec.currency_id.symbol)
+ "Planning amount should equal "
+ "to the released amount {:,.2f} %(symbol)s",
+ symbol=rec.currency_id.symbol,
+ ).format(rec.released_amount)
)
# Check plan vs intial
if (
@@ -380,8 +383,9 @@ def _check_budget_amount(self):
raise UserError(
_(
"Planning amount should be greater than "
- "initial balance {:,.2f} {}"
- ).format(rec.amount_initial, rec.currency_id.symbol)
+ "initial balance {:,.2f} %(symbol)s",
+ symbol=rec.currency_id.symbol,
+ ).format(rec.amount_initial)
)
def action_draft(self):
diff --git a/budget_control/models/budget_period.py b/budget_control/models/budget_period.py
index 2c721ebf..e9864e35 100644
--- a/budget_control/models/budget_period.py
+++ b/budget_control/models/budget_period.py
@@ -438,7 +438,7 @@ def _check_budget_available(self, controls, budget_period):
balance_currency = self._get_balance_currency(
company, balance, doc_currency, date_commit
)
- fomatted_balance = format_amount(
+ formatted_balance = format_amount(
self.env, balance_currency, doc_currency
)
analytic_name = Analytic.browse(analytic_id).display_name
@@ -447,7 +447,11 @@ def _check_budget_available(self, controls, budget_period):
template_lines.display_name, analytic_name
)
warnings.append(
- _("{0}, will result in {1}").format(analytic_name, fomatted_balance)
+ _(
+ "%(analytic_name)s, will result in %(formatted_balance)s",
+ analytic_name=analytic_name,
+ formatted_balance=formatted_balance,
+ )
)
return list(set(warnings))