Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nymphalis_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
Nymphalis
nymphalis_project
Commits
0df01337
Commit
0df01337
authored
6 years ago
by
Juliana
Browse files
Options
Downloads
Patches
Plain Diff
Ajout nom tache automatique
parent
dbde2791
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/project.py
+131
-109
131 additions, 109 deletions
models/project.py
with
131 additions
and
109 deletions
models/project.py
+
131
−
109
View file @
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
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment