Merge PR #1003 into 16.0

Signed-off-by pedrobaeza
pull/1014/head
OCA-git-bot 2023-02-09 14:56:14 +00:00
commit 2c9e91720c
5 changed files with 11 additions and 14 deletions

View File

@ -1,10 +1,11 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.12.0
_commit: v1.14.1
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
dependency_installation_mode: PIP
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
github_enable_codecov: true
github_enable_makepot: true
github_enable_stale_action: true

View File

@ -11,7 +11,7 @@ on:
jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

View File

@ -28,7 +28,7 @@ jobs:
fi
done
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
strategy:

View File

@ -101,7 +101,7 @@ repos:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py

View File

@ -16,6 +16,7 @@ class AccountGroup(models.Model):
)
compute_account_ids = fields.Many2many(
"account.account",
recursive=True,
compute="_compute_group_accounts",
string="Compute accounts",
store=True,
@ -58,16 +59,11 @@ class AccountGroup(models.Model):
group.level = group.parent_id.level + 1
@api.depends(
"code_prefix_start",
"account_ids",
"account_ids.code",
"group_child_ids",
"group_child_ids.account_ids.code",
"group_child_ids.compute_account_ids",
)
def _compute_group_accounts(self):
account_obj = self.env["account.account"]
accounts = account_obj.search([])
for group in self:
prefix = group.code_prefix_start if group.code_prefix_start else group.name
gr_acc = accounts.filtered(lambda a: a.code.startswith(prefix)).ids
group.compute_account_ids = [(6, 0, gr_acc)]
for one in self:
one.compute_account_ids = (
one.account_ids | one.group_child_ids.compute_account_ids
)