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 # 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 _src_path: gh:oca/oca-addons-repo-template
ci: GitHub ci: GitHub
dependency_installation_mode: PIP dependency_installation_mode: PIP
generate_requirements_txt: true generate_requirements_txt: true
github_check_license: true github_check_license: true
github_ci_extra_env: {}
github_enable_codecov: true github_enable_codecov: true
github_enable_makepot: true github_enable_makepot: true
github_enable_stale_action: true github_enable_stale_action: true

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@ class AccountGroup(models.Model):
) )
compute_account_ids = fields.Many2many( compute_account_ids = fields.Many2many(
"account.account", "account.account",
recursive=True,
compute="_compute_group_accounts", compute="_compute_group_accounts",
string="Compute accounts", string="Compute accounts",
store=True, store=True,
@ -58,16 +59,11 @@ class AccountGroup(models.Model):
group.level = group.parent_id.level + 1 group.level = group.parent_id.level + 1
@api.depends( @api.depends(
"code_prefix_start",
"account_ids", "account_ids",
"account_ids.code", "group_child_ids.compute_account_ids",
"group_child_ids",
"group_child_ids.account_ids.code",
) )
def _compute_group_accounts(self): def _compute_group_accounts(self):
account_obj = self.env["account.account"] for one in self:
accounts = account_obj.search([]) one.compute_account_ids = (
for group in self: one.account_ids | one.group_child_ids.compute_account_ids
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)]