Skip to content
Extraits de code Groupes Projets
Valider 3295aba8 rédigé par Juliana's avatar Juliana
Parcourir les fichiers

Modifs CRON

parent 078357fd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -27,31 +27,20 @@ class NymphProject(models.Model):
def _cron_project_zone(self):
projects = self.env['project.project'].search([
('zone_etude', '=', False)])
print ("projets", str(projects))
for p in projects:
body = '<li>Projet : '+p.name+'</li>'
body_html = "<div><b>%(title)s</b> : %(body)s</div>" % {
'title': "Zone étude à remplir",
'body': body,
'partner_ids': [(p.user_id.partner_id.id)],
}
# message = self.env['mail.message'].create(
# {
# 'message_type': "notification",
# "subtype": 1, # subject type
# 'body': body,
# 'subject': "Message subject",
# 'needaction_partner_ids': [(p.user_id.partner_id.id)],
# # partner to whom you send notification
# })
p.message_post(
body=body_html,
subject='Zone étude',
message_type='notification',
partner_ids=[(p.user_id.partner_id.id)],
subtype_id=1,
model='project.project',
res_id=p.id
subtype='mail.mt_comment',
partner_ids=[(6, 0, ([p.user_id.partner_id.id]))],
)
......@@ -109,30 +98,20 @@ class NymphProjectTask(models.Model):
tasks = self.env['project.task'].search([
('date_deadline', '<', datetime.now().date() + timedelta(days=15))])
for p in tasks:
print ("task", str(p.name))
print ("date", str(p.date_deadline))
# responsable = p.user_id.partner_id.id
body = '<li>Tâche: '+p.name+'</li>'
body += '<li>Deadline: '+str(p.date_deadline)+'</li>'
body_html = "<div><b>%(title)s</b> : %(body)s</div>" % {
'title': "Tâche à effectuer avant la deadline",
'body': body,
'partner_ids': [(p.user_id.partner_id.id)],
}
# message = self.env['mail.message'].create({
# 'message_type': "notification",
# "subtype": 1, # subject type
# 'body': body,
# 'subject': "Message subject",
# 'needaction_partner_ids': [(p.user_id.partner_id.id)],
# })
p.message_post(
body=body_html,
subject='Tâches restantes à effectuer',
message_type='notification',
partner_ids=[(p.user_id.partner_id.id)],
subtype_id=1,
model='project.task',
res_id=p.id
subtype='mail.mt_comment',
partner_ids=[(6, 0, ([p.user_id.partner_id.id]))],
)
......
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