des evenement recurrents s'affiche: dates à voir
This commit is contained in:
parent
67451339ff
commit
1eef4a6e4f
@ -18,6 +18,7 @@
|
|||||||
""" GOLEM activities related models """
|
""" GOLEM activities related models """
|
||||||
|
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
class GolemActivityType(models.Model):
|
class GolemActivityType(models.Model):
|
||||||
""" GOLEM Activity Type """
|
""" GOLEM Activity Type """
|
||||||
@ -172,32 +173,38 @@ class GolemActivity(models.Model):
|
|||||||
##########################################
|
##########################################
|
||||||
@api.multi
|
@api.multi
|
||||||
def read(self, fields=None, load='_classic_read'):
|
def read(self, fields=None, load='_classic_read'):
|
||||||
print '________________________'
|
#print '________________________'
|
||||||
print self.ids
|
#print self.ids
|
||||||
fields2 = fields and fields[:] or None
|
fields2 = fields and fields[:] or None
|
||||||
select = map(lambda x: (x, self.calendar_id2real_id(x)), self.ids)
|
select = map(lambda x: (x, self.calendar_id2real_id(x)), self.ids)
|
||||||
print select
|
print select
|
||||||
real_events = self.browse([real_id for calendar_id, real_id in select])
|
real_events = self.browse([real_id for calendar_id, real_id in select])
|
||||||
|
#verify that attribute of real id is working after next statement
|
||||||
real_data = super(GolemActivity, real_events).read(fields=fields2, load=load)
|
real_data = super(GolemActivity, real_events).read(fields=fields2, load=load)
|
||||||
real_data = dict((d['id'], d) for d in real_data)
|
real_data = dict((d['id'], d) for d in real_data)
|
||||||
print '------------------------------------'
|
#print '------------------------------------'
|
||||||
print real_data
|
#print real_data
|
||||||
print '------------------------------------'
|
#print '------------------------------------'
|
||||||
print real_events
|
#print real_events
|
||||||
print '------------------------------------'
|
#print '------------------------------------'
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for calendar_id, real_id in select:
|
for calendar_id, real_id in select:
|
||||||
res = real_data[real_id].copy()
|
res = real_data[real_id].copy()
|
||||||
print res
|
res['id'] = calendar_id
|
||||||
|
result.append(res)
|
||||||
|
return result
|
||||||
|
|
||||||
|
"""print res
|
||||||
print '_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_'
|
print '_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_'
|
||||||
print calendar_id
|
print calendar_id
|
||||||
print '_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_'
|
print '_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_'
|
||||||
print real_id
|
print real_id"""
|
||||||
|
|
||||||
#ls = self.calendar_id2real_id(calendar_id, with_date=res and res.get('duration', 0) > 0 and res.get('duration') or 1)
|
#ls = self.calendar_id2real_id(calendar_id, with_date=res and res.get('duration', 0) > 0 and res.get('duration') or 1)
|
||||||
|
|
||||||
"""
|
|
||||||
for calendar_id, real_id in select:
|
"""for calendar_id, real_id in select:
|
||||||
print calendar_id
|
print calendar_id
|
||||||
print real_id"""
|
print real_id"""
|
||||||
|
|
||||||
@ -215,16 +222,29 @@ class GolemActivity(models.Model):
|
|||||||
return calendar_id and int(calendar_id) or calendar_id
|
return calendar_id and int(calendar_id) or calendar_id
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def real_id2calendar_id(self, record_id, date):
|
def real_id2calendar_id(self, record_id):
|
||||||
return '%s_%s' % (record_id, date)
|
activity = self.env['golem.activity'].browse(record_id)
|
||||||
|
dates = []
|
||||||
|
delta = timedelta(days=7)
|
||||||
|
date = fields.Date.from_string(activity.date_start)
|
||||||
|
while date <= fields.Date.from_string(activity.date_stop):
|
||||||
|
print date
|
||||||
|
print activity.date_stop
|
||||||
|
dates.append('%s_%s' % (record_id, date))
|
||||||
|
date += delta
|
||||||
|
return dates
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def get_recurrent_ids(self):
|
def get_recurrent_ids(self):
|
||||||
result = []
|
result = []
|
||||||
for activity in self:
|
for activity in self:
|
||||||
|
print '___________________tktk______'
|
||||||
#if not meeting.recurrency or not meeting.rrule:
|
#if not meeting.recurrency or not meeting.rrule:
|
||||||
|
if activity.is_recurrent:
|
||||||
|
result += activity.real_id2calendar_id(activity.id)
|
||||||
|
else:
|
||||||
result.append(activity.id)
|
result.append(activity.id)
|
||||||
result.append(activity.real_id2calendar_id(activity.id, activity.date_start))
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
Loading…
x
Reference in New Issue
Block a user