Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
nymphalis_project
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
Nymphalis
nymphalis_project
Validations
0df01337
Valider
0df01337
rédigé
Il y a 6 ans
par
Juliana
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Ajout nom tache automatique
parent
dbde2791
Aucune branche associée trouvée
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é
models/project.py
+131
-109
131 ajouts, 109 suppressions
models/project.py
avec
131 ajouts
et
109 suppressions
models/project.py
+
131
−
109
Voir le fichier @
0df01337
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from
odoo
import
models
,
fields
,
api
from
odoo
import
models
,
fields
,
api
from
datetime
import
datetime
,
date
,
time
,
timedelta
from
datetime
import
datetime
,
timedelta
class
NymphProject
(
models
.
Model
):
class
NymphProject
(
models
.
Model
):
_name
=
"
project.project
"
_name
=
"
project.project
"
...
@@ -22,9 +23,10 @@ class NymphProject(models.Model):
...
@@ -22,9 +23,10 @@ class NymphProject(models.Model):
access
=
fields
.
Boolean
(
"
Conditions d
'
accessibilité
"
)
access
=
fields
.
Boolean
(
"
Conditions d
'
accessibilité
"
)
path_drive
=
fields
.
Char
(
"
Lien Drive
"
)
path_drive
=
fields
.
Char
(
"
Lien Drive
"
)
#
# CRON de vérification Zone Validée
# CRON de vérification Zone Validée
def
_cron_project_zone
(
self
):
def
_cron_project_zone
(
self
):
projects
=
self
.
env
[
'
project.project
'
].
search
([(
'
zone_etude
'
,
'
=
'
,
False
)],)
projects
=
self
.
env
[
'
project.project
'
].
search
([
(
'
zone_etude
'
,
'
=
'
,
False
)])
print
(
"
projets
"
,
str
(
projects
))
print
(
"
projets
"
,
str
(
projects
))
for
p
in
projects
:
for
p
in
projects
:
body
=
'
<li>Projet :
'
+
p
.
name
+
'
</li>
'
body
=
'
<li>Projet :
'
+
p
.
name
+
'
</li>
'
...
@@ -33,13 +35,15 @@ class NymphProject(models.Model):
...
@@ -33,13 +35,15 @@ class NymphProject(models.Model):
'
body
'
:
body
,
'
body
'
:
body
,
}
}
message
=
self
.
env
[
'
mail.message
'
].
create
({
'
message_type
'
:
"
notification
"
,
# message = self.env['mail.message'].create(
"
subtype
"
:
1
,
# subject type
# {
'
body
'
:
body
,
# 'message_type': "notification",
'
subject
'
:
"
Message subject
"
,
# "subtype": 1, # subject type
'
needaction_partner_ids
'
:
[(
p
.
user_id
.
partner_id
.
id
)],
# 'body': body,
# partner to whom you send notification
# 'subject': "Message subject",
})
# 'needaction_partner_ids': [(p.user_id.partner_id.id)],
# # partner to whom you send notification
# })
p
.
message_post
(
p
.
message_post
(
body
=
body_html
,
body
=
body_html
,
subject
=
'
Zone étude
'
,
subject
=
'
Zone étude
'
,
...
@@ -50,22 +54,37 @@ class NymphProject(models.Model):
...
@@ -50,22 +54,37 @@ class NymphProject(models.Model):
res_id
=
p
.
id
res_id
=
p
.
id
)
)
class
NymphProjectTaskType
(
models
.
Model
):
class
NymphProjectTaskType
(
models
.
Model
):
_inherit
=
'
project.task.type
'
_inherit
=
'
project.task.type
'
case_default
=
fields
.
Boolean
(
string
=
'
Default step
'
)
case_default
=
fields
.
Boolean
(
string
=
'
Default step
'
)
class
NymphProjectTask
(
models
.
Model
):
class
NymphProjectTask
(
models
.
Model
):
_inherit
=
'
project.task
'
_inherit
=
'
project.task
'
@api.model
def
default_get
(
self
,
fields_list
):
result
=
super
(
NymphProjectTask
,
self
).
default_get
(
fields_list
)
project_id
=
self
.
env
[
'
project.project
'
].
browse
(
self
.
env
.
context
[
'
default_project_id
'
])
result
[
'
name
'
]
=
project_id
.
name
return
result
type_task
=
fields
.
Selection
([
type_task
=
fields
.
Selection
([
(
'
bureau
'
,
'
Bureau
'
),
(
'
bureau
'
,
'
Bureau
'
),
(
'
terrain
'
,
'
Terrain
'
),
(
'
terrain
'
,
'
Terrain
'
),
(
'
reunion
'
,
'
Réunion
'
),
(
'
reunion
'
,
'
Réunion
'
),
],
string
=
'
Type de tâche
'
)
],
string
=
'
Type de tâche
'
)
moment
=
fields
.
Selection
([(
'
diurne
'
,
'
Diurne
'
),
(
'
nocturne
'
,
'
Nocturne
'
)],
string
=
"
Moment tâche
"
)
moment
=
fields
.
Selection
([
(
'
diurne
'
,
'
Diurne
'
),
(
'
nocturne
'
,
'
Nocturne
'
)],
string
=
"
Moment tâche
"
)
period_id
=
fields
.
Many2one
(
'
project.period
'
,
string
=
'
Période
'
)
period_id
=
fields
.
Many2one
(
'
project.period
'
,
string
=
'
Période
'
)
date_start
=
fields
.
Datetime
(
string
=
'
Starting Date
'
,
default
=
fields
.
Datetime
.
now
,
index
=
True
,
copy
=
False
)
date_start
=
fields
.
Datetime
(
string
=
'
Starting Date
'
,
default
=
fields
.
Datetime
.
now
,
index
=
True
,
copy
=
False
)
date_end
=
fields
.
Datetime
(
string
=
'
Ending Date
'
,
index
=
True
,
copy
=
False
)
date_end
=
fields
.
Datetime
(
string
=
'
Ending Date
'
,
index
=
True
,
copy
=
False
)
@api.model
@api.model
...
@@ -84,25 +103,27 @@ class NymphProjectTask(models.Model):
...
@@ -84,25 +103,27 @@ class NymphProjectTask(models.Model):
self
.
date_end
=
self
.
period_id
.
date_end
self
.
date_end
=
self
.
period_id
.
date_end
self
.
date_deadline
=
self
.
period_id
.
date_end
.
date
()
self
.
date_deadline
=
self
.
period_id
.
date_end
.
date
()
#
# CRON sur Tasks deadline
# CRON sur Tasks deadline
def
_cron_tasks_todo
(
self
):
def
_cron_tasks_todo
(
self
):
tasks
=
self
.
env
[
'
project.task
'
].
search
([(
'
date_deadline
'
,
'
<
'
,
datetime
.
now
().
date
()
+
timedelta
(
days
=
15
))],)
tasks
=
self
.
env
[
'
project.task
'
].
search
([
(
'
date_deadline
'
,
'
<
'
,
datetime
.
now
().
date
()
+
timedelta
(
days
=
15
))])
for
p
in
tasks
:
for
p
in
tasks
:
print
(
"
task
"
,
str
(
p
.
name
))
print
(
"
task
"
,
str
(
p
.
name
))
print
(
"
date
"
,
str
(
p
.
date_deadline
))
print
(
"
date
"
,
str
(
p
.
date_deadline
))
responsable
=
p
.
user_id
.
partner_id
.
id
#
responsable = p.user_id.partner_id.id
body
=
'
<li>Tâche:
'
+
p
.
name
+
'
</li>
'
body
=
'
<li>Tâche:
'
+
p
.
name
+
'
</li>
'
body
+=
'
<li>Deadline:
'
+
str
(
p
.
date_deadline
)
+
'
</li>
'
body
+=
'
<li>Deadline:
'
+
str
(
p
.
date_deadline
)
+
'
</li>
'
body_html
=
"
<div><b>%(title)s</b> : %(body)s</div>
"
%
{
body_html
=
"
<div><b>%(title)s</b> : %(body)s</div>
"
%
{
'
title
'
:
"
Tâche à effectuer avant la deadline
"
,
'
title
'
:
"
Tâche à effectuer avant la deadline
"
,
'
body
'
:
body
,
'
body
'
:
body
,
}
}
message
=
self
.
env
[
'
mail.message
'
].
create
({
'
message_type
'
:
"
notification
"
,
# message = self.env['mail.message'].create({
"
subtype
"
:
1
,
# subject type
# 'message_type': "notification",
'
body
'
:
body
,
# "subtype": 1, # subject type
'
subject
'
:
"
Message subject
"
,
# 'body': body,
'
needaction_partner_ids
'
:
[(
p
.
user_id
.
partner_id
.
id
)],
# 'subject': "Message subject",
})
# 'needaction_partner_ids': [(p.user_id.partner_id.id)],
# })
p
.
message_post
(
p
.
message_post
(
body
=
body_html
,
body
=
body_html
,
subject
=
'
Tâches restantes à effectuer
'
,
subject
=
'
Tâches restantes à effectuer
'
,
...
@@ -113,6 +134,7 @@ class NymphProjectTask(models.Model):
...
@@ -113,6 +134,7 @@ class NymphProjectTask(models.Model):
res_id
=
p
.
id
res_id
=
p
.
id
)
)
class
NymphProjectPeriod
(
models
.
Model
):
class
NymphProjectPeriod
(
models
.
Model
):
_name
=
'
project.period
'
_name
=
'
project.period
'
_description
=
"
Période projet
"
_description
=
"
Période projet
"
...
...
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