Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
C
cgscop_partner_alfodoo
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
Confédération Générale des SCOP
cgscop_partner_alfodoo
Validations
ef0e3bed
Valider
ef0e3bed
rédigé
13 oct. 2022
par
Benjamin - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[update] add create method to avoid . before folder name
parent
87f09031
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
.pre-commit-config.yaml
+11
-13
11 ajouts, 13 suppressions
.pre-commit-config.yaml
models/res_partner.py
+23
-1
23 ajouts, 1 suppression
models/res_partner.py
avec
34 ajouts
et
14 suppressions
.pre-commit-config.yaml
+
11
−
13
Voir le fichier @
ef0e3bed
...
@@ -6,10 +6,8 @@ exclude: |
...
@@ -6,10 +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
^docs/_templates/.*\.html$|
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
# You don't usually want a bot to modify your legal texts
...
@@ -28,7 +26,7 @@ repos:
...
@@ -28,7 +26,7 @@ repos:
language
:
fail
language
:
fail
files
:
"
\\
.rej$"
files
:
"
\\
.rej$"
-
repo
:
https://github.com/oca/maintainer-tools
-
repo
:
https://github.com/oca/maintainer-tools
rev
:
ab1d7f6
rev
:
7d8a9f9ad73db0976fb03cbee43d953bc29b89e9
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
...
@@ -46,11 +44,11 @@ repos:
...
@@ -46,11 +44,11 @@ repos:
-
--remove-duplicate-keys
-
--remove-duplicate-keys
-
--remove-unused-variables
-
--remove-unused-variables
-
repo
:
https://github.com/psf/black
-
repo
:
https://github.com/psf/black
rev
:
2
0.8b1
rev
:
2
2.3.0
hooks
:
hooks
:
-
id
:
black
-
id
:
black
-
repo
:
https://github.com/pre-commit/mirrors-prettier
-
repo
:
https://github.com/pre-commit/mirrors-prettier
rev
:
v2.
1
.2
rev
:
v2.
6
.2
hooks
:
hooks
:
-
id
:
prettier
-
id
:
prettier
name
:
prettier (with plugin-xml)
name
:
prettier (with plugin-xml)
...
@@ -61,7 +59,7 @@ repos:
...
@@ -61,7 +59,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
:
v
7.
8.1
rev
:
v8.1
5.0
hooks
:
hooks
:
-
id
:
eslint
-
id
:
eslint
verbose
:
true
verbose
:
true
...
@@ -69,7 +67,7 @@ repos:
...
@@ -69,7 +67,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
:
v
3
.2.0
rev
:
v
4
.2.0
hooks
:
hooks
:
-
id
:
trailing-whitespace
-
id
:
trailing-whitespace
# exclude autogenerated files
# exclude autogenerated files
...
@@ -91,12 +89,12 @@ repos:
...
@@ -91,12 +89,12 @@ 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.
7.2
rev
:
v2.
32.1
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.
5
.1
rev
:
5.
10
.1
hooks
:
hooks
:
-
id
:
isort
-
id
:
isort
name
:
isort except __init__.py
name
:
isort except __init__.py
...
@@ -104,13 +102,13 @@ repos:
...
@@ -104,13 +102,13 @@ repos:
-
--settings=.
-
--settings=.
exclude
:
/__init__\.py$
exclude
:
/__init__\.py$
-
repo
:
https://gitlab.com/PyCQA/flake8
-
repo
:
https://gitlab.com/PyCQA/flake8
rev
:
3.
8.3
rev
:
3.
9.2
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/PyCQA/pylint
rev
:
pylint-2.5.3
rev
:
v2.11.1
hooks
:
hooks
:
-
id
:
pylint
-
id
:
pylint
name
:
pylint with optional checks
name
:
pylint with optional checks
...
@@ -119,7 +117,7 @@ repos:
...
@@ -119,7 +117,7 @@ repos:
-
--exit-zero
-
--exit-zero
verbose
:
true
verbose
:
true
additional_dependencies
:
&pylint_deps
additional_dependencies
:
&pylint_deps
-
pylint-odoo==
3.
5.0
-
pylint-odoo==5.0
.5
-
id
:
pylint
-
id
:
pylint
name
:
pylint with mandatory checks
name
:
pylint with mandatory checks
args
:
args
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
models/res_partner.py
+
23
−
1
Voir le fichier @
ef0e3bed
...
@@ -29,6 +29,7 @@ class AlfodooResPartner(models.Model):
...
@@ -29,6 +29,7 @@ class AlfodooResPartner(models.Model):
allow_delete
=
False
,
allow_delete
=
False
,
create_parent_get
=
"
_get_parent_path
"
,
create_parent_get
=
"
_get_parent_path
"
,
create_properties_get
=
"
_get_folder_properties
"
,
create_properties_get
=
"
_get_folder_properties
"
,
create_method
=
"
_create_coop_folder
"
,
)
)
# ------------------------------------------------------
# ------------------------------------------------------
...
@@ -66,6 +67,22 @@ class AlfodooResPartner(models.Model):
...
@@ -66,6 +67,22 @@ class AlfodooResPartner(models.Model):
}
}
}
}
def
_create_coop_folder
(
self
,
records
,
backend
):
path
=
backend
.
initial_directory_write
root_folder
=
backend
.
get_folder_by_path
(
path
)
for
partner
in
self
:
folder_name
=
(
partner
.
name
if
not
partner
.
name
.
startswith
(
"
.
"
)
else
partner
.
name
.
replace
(
"
.
"
,
"
_
"
,
1
)
)
sanitized_name
=
backend
.
sanitize_cmis_name
(
folder_name
)
name
=
backend
.
get_unique_folder_name
(
sanitized_name
,
root_folder
)
properties
=
partner
.
_get_folder_properties
(
records
,
backend
)
partner
.
partner_cmis_folder
=
root_folder
.
createFolder
(
name
,
properties
[
partner
.
id
]
)
# ------------------------------------------------------
# ------------------------------------------------------
# Override ORM
# Override ORM
# ------------------------------------------------------
# ------------------------------------------------------
...
@@ -93,7 +110,12 @@ class AlfodooResPartner(models.Model):
...
@@ -93,7 +110,12 @@ class AlfodooResPartner(models.Model):
record
.
id
record
.
id
)
)
if
vals
.
get
(
"
name
"
,
False
):
if
vals
.
get
(
"
name
"
,
False
):
properties
.
update
({
"
cmis:name
"
:
record
.
name
})
folder_name
=
(
record
.
name
if
not
record
.
name
.
startswith
(
"
.
"
)
else
record
.
name
.
replace
(
"
.
"
,
"
_
"
,
1
)
)
properties
.
update
({
"
cmis:name
"
:
folder_name
})
folder
=
backend
.
get_cmis_object
(
record
)
folder
=
backend
.
get_cmis_object
(
record
)
folder
.
updateProperties
(
properties
)
folder
.
updateProperties
(
properties
)
except
(
except
(
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter