Skip to content
Extraits de code Groupes Projets
Valider 541855a0 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[UPD] move Alfresco upload to _post function

parent aa00b414
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -6,6 +6,8 @@ exclude: | ...@@ -6,6 +6,8 @@ exclude: |
^setup/|/static/description/index\.html$| ^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files # We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized) # Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/| /static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying # Repos using Sphinx to generate docs don't need prettying
...@@ -25,8 +27,13 @@ repos: ...@@ -25,8 +27,13 @@ repos:
entry: found forbidden files; remove them entry: found forbidden files; remove them
language: fail language: fail
files: "\\.rej$" files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools - repo: https://github.com/oca/maintainer-tools
rev: 7d8a9f9ad73db0976fb03cbee43d953bc29b89e9 rev: ab1d7f6
hooks: hooks:
# update the NOT INSTALLABLE ADDONS section above # update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons - id: oca-update-pre-commit-excluded-addons
...@@ -48,7 +55,7 @@ repos: ...@@ -48,7 +55,7 @@ repos:
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pre-commit/mirrors-prettier - repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.6.2 rev: v2.1.2
hooks: hooks:
- id: prettier - id: prettier
name: prettier (with plugin-xml) name: prettier (with plugin-xml)
...@@ -59,7 +66,7 @@ repos: ...@@ -59,7 +66,7 @@ repos:
- --plugin=@prettier/plugin-xml - --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint - repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.15.0 rev: v7.8.1
hooks: hooks:
- id: eslint - id: eslint
verbose: true verbose: true
...@@ -67,7 +74,7 @@ repos: ...@@ -67,7 +74,7 @@ repos:
- --color - --color
- --fix - --fix
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0 rev: v3.2.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
# exclude autogenerated files # exclude autogenerated files
...@@ -89,37 +96,33 @@ repos: ...@@ -89,37 +96,33 @@ repos:
- id: mixed-line-ending - id: mixed-line-ending
args: ["--fix=lf"] args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.32.1 rev: v2.7.2
hooks: hooks:
- 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
args: args:
- --settings=. - --settings=.
exclude: /__init__\.py$ exclude: /__init__\.py$
- repo: https://gitlab.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.9.2 rev: 3.8.3
hooks: hooks:
- id: flake8 - id: flake8
name: flake8 name: flake8
additional_dependencies: ["flake8-bugbear==20.1.4"] additional_dependencies: ["flake8-bugbear==20.1.4"]
- repo: https://github.com/PyCQA/pylint - repo: https://github.com/OCA/pylint-odoo
rev: v2.11.1 rev: 7.0.2
hooks: hooks:
- id: pylint - id: pylint_odoo
name: pylint with optional checks name: pylint with optional checks
args: args:
- --rcfile=.pylintrc - --rcfile=.pylintrc
- --exit-zero - --exit-zero
verbose: true verbose: true
additional_dependencies: &pylint_deps - id: pylint_odoo
- pylint-odoo==5.0.5
- id: pylint
name: pylint with mandatory checks
args: args:
- --rcfile=.pylintrc-mandatory - --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps
...@@ -81,20 +81,31 @@ class AccountMove(models.Model): ...@@ -81,20 +81,31 @@ class AccountMove(models.Model):
# ------------------------------------------------------ # ------------------------------------------------------
# Override parent # Override parent
# ------------------------------------------------------ # ------------------------------------------------------
def action_post(self): def _post(self, soft=True):
""" """
Charge la facture ou l'avoir sur Alfresco s'l s'agit d'une cotisation AURA Charge la facture ou l'avoir sur Alfresco s'il s'agit d'une cotisation AURA
Stocke le noderef sur la facture Stocke le noderef sur la facture
""" """
ur_aura = self.env.ref("__import__.ur_arh") ur_aura = self.env.ref("__import__.ur_arh")
res = super().action_post() move_ids = super(AccountMove, self)._post(soft)
for invoice in self: if len(move_ids) == 1:
try: try:
if invoice.is_contribution and invoice.company_id == ur_aura: if move_ids.is_contribution and move_ids.company_id == ur_aura:
invoice.node_ref = invoice.upload_contribution_file() move_ids.node_ref = move_ids.upload_contribution_file()
except Exception as e: except Exception as e:
raise e raise e
return res else:
for move in move_ids:
if move.is_contribution and move.company_id == ur_aura:
description = "%s - %s - PDF Cotisation" % (
move.name,
move.partner_id.name,
)
move.node_ref = move.with_delay(
description=description
).upload_contribution_file()
return move_ids
def button_draft(self): def button_draft(self):
""" """
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter