Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
A
acc_rest_api
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
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Le Filament
Opération Auto-Consommation Collective
acc_rest_api
Validations
14ae4a48
Valider
14ae4a48
rédigé
8 juin 2022
par
Juliana
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[FIX]Error file copied
parent
550bdcbd
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
services/operation_services.py
+15
-31
15 ajouts, 31 suppressions
services/operation_services.py
avec
15 ajouts
et
31 suppressions
services/operation_services.py
+
15
−
31
Voir le fichier @
14ae4a48
...
@@ -180,12 +180,13 @@ class OperationsService(Component):
...
@@ -180,12 +180,13 @@ class OperationsService(Component):
"""
"""
operation
=
self
.
env
[
"
acc.operation
"
].
browse
(
_id
)
operation
=
self
.
env
[
"
acc.operation
"
].
browse
(
_id
)
role
=
self
.
_get_role
(
operation
)
role
=
self
.
_get_role
(
operation
)
base_url
=
self
.
env
[
"
ir.config_parameter
"
].
sudo
().
get_param
(
"
web.base.url
"
)
base_url
=
self
.
env
[
'
ir.config_parameter
'
].
sudo
().
get_param
(
'
web.base.url
'
)
if
not
role
.
get
(
"
isIn
"
):
if
not
role
.
get
(
"
isIn
"
):
return
AccessError
()
return
AccessError
()
self
.
request
.
params
.
get
(
"
type
"
,
False
)
type
=
self
.
request
.
params
.
get
(
"
type
"
,
False
)
datas
=
{
datas
=
{
"
role
"
:
role
,
"
role
"
:
role
,
...
@@ -209,36 +210,21 @@ class OperationsService(Component):
...
@@ -209,36 +210,21 @@ class OperationsService(Component):
}
}
)
if
acc_account_ids
else
[]
)
if
acc_account_ids
else
[]
else
:
else
:
# Récupération de toutes les factures liées à l'opération spécifiée
acc_account_ids
=
self
.
env
[
"
acc.account
"
].
search
(
[(
"
acc_operation_id
"
,
"
=
"
,
_id
)]
)
datas
[
"
documents
"
]
=
acc_account_ids
.
mapped
(
lambda
n
:
{
"
id
"
:
n
.
id
,
"
name
"
:
n
.
name
,
"
date
"
:
n
.
date
,
"
start_date
"
:
n
.
start_date
,
"
end_date
"
:
n
.
end_date
,
"
amount_total
"
:
n
.
amount_total
,
"
url
"
:
base_url
+
n
.
get_portal_url
(
report_type
=
"
pdf
"
),
}
)
# Récupération de toutes les factures liées à l'opération spécifiée
# Récupération de toutes les factures liées à l'opération spécifiée
domain
=
[(
"
acc_operation_id
"
,
"
=
"
,
_id
)]
domain
=
[(
"
acc_operation_id
"
,
"
=
"
,
_id
)]
domain_pmo
=
[(
"
acc_operation_id
"
,
"
=
"
,
_id
)]
domain_pmo
=
[(
"
acc_operation_id
"
,
"
=
"
,
_id
)]
role
=
self
.
_get_role
(
operation
)
role
=
self
.
_get_role
(
operation
)
if
role
.
get
(
"
isConsumer
"
)
or
role
.
get
(
"
isProductor
"
):
if
role
.
get
(
"
isConsumer
"
):
domain
+=
[(
"
type
"
,
"
=
"
,
"
vente_achat
"
)]
domain
+=
[(
"
type
"
,
"
=
"
,
"
achat
"
)]
if
role
.
get
(
"
isProductor
"
):
domain
+=
[(
"
type
"
,
"
=
"
,
"
vente
"
)]
if
role
.
get
(
"
isPmo
"
):
if
role
.
get
(
"
isPmo
"
):
domain_pmo
+=
[(
"
type
"
,
"
!=
"
,
False
)]
domain_pmo
+=
[(
"
type
"
,
"
!=
"
,
False
)]
acc_contract_ids
=
self
.
env
[
"
acc.contract
"
].
sudo
().
search
(
domain_pmo
)
acc_contract_ids
=
self
.
env
[
"
acc.contract
"
].
sudo
().
search
(
domain_pmo
)
else
:
else
:
acc_contract_ids
=
self
.
env
[
"
acc.contract
"
].
sudo
().
search
(
domain
)
acc_contract_ids
=
self
.
env
[
"
acc.contract
"
].
sudo
().
search
(
domain
)
datas
[
"
contracts
"
]
=
acc_contract_ids
.
mapped
(
datas
[
"
contracts
"
]
=
acc_contract_ids
.
mapped
(
lambda
n
:
{
lambda
n
:
{
"
id
"
:
n
.
id
,
"
id
"
:
n
.
id
,
"
name
"
:
n
.
name
,
"
name
"
:
n
.
name
,
"
start_date
"
:
n
.
start_date
,
"
start_date
"
:
n
.
start_date
,
...
@@ -247,8 +233,6 @@ class OperationsService(Component):
...
@@ -247,8 +233,6 @@ class OperationsService(Component):
"
url
"
:
base_url
+
n
.
get_portal_url
(),
"
url
"
:
base_url
+
n
.
get_portal_url
(),
}
}
)
if
acc_contract_ids
else
[]
)
if
acc_contract_ids
else
[]
}
)
return
datas
return
datas
@restapi.method
(
@restapi.method
(
...
...
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