[IMP] Add Demo data, Test on Event, Test en recurrence + [FIX] google_event__internal_id size changed, because more than 128 char for some users

bzr revid: jke@openerp.com-20131218110418-wdubheq1by0j0daf
This commit is contained in:
jke-openerp 2013-12-18 12:04:18 +01:00
parent d2aef70633
commit 6a0b69a7e7
8 changed files with 53 additions and 60 deletions

View File

@ -38,13 +38,12 @@ If you need to manage your meetings, you should install the CRM module.
'author': 'OpenERP SA',
'category': 'Hidden/Dependency',
'website': 'http://www.openerp.com',
'demo': ['crm_meeting_demo.xml'],
'demo': ['base_calendar_demo.xml'],
'data': [
'security/calendar_security.xml',
'security/ir.model.access.csv',
'crm_meeting_view.xml',
'base_calendar_view.xml',
'base_calendar_data.xml',
# 'res_config_view.xml',
],
'js': [
'static/src/js/*.js'
@ -53,7 +52,10 @@ If you need to manage your meetings, you should install the CRM module.
'css': [
'static/src/css/base_calender.css'
],
#'test' : ['test/base_calendar_test.yml'],
'test' : [
'test/base_calendar_test.yml',
'test/test_crm_recurrent_meeting_case2.yml'
],
'installable': True,
'application': True,
'auto_install': False,

View File

@ -907,20 +907,18 @@ class crm_meeting(osv.Model):
},
}
_columns = {
'create_date': fields.datetime('Creation Date', readonly=True),
'write_date': fields.datetime('Write Date', readonly=True),
# 'create_date': fields.datetime('Creation Date', readonly=True),
# 'write_date': fields.datetime('Write Date', readonly=True),
'id': fields.integer('ID', readonly=True),
'state': fields.selection([('draft', 'Unconfirmed'), ('open', 'Confirmed')], string='Status', size=16, readonly=True, track_visibility='onchange'),
# Meeting fields
'name': fields.char('Meeting Subject', size=128, required=True, states={'done': [('readonly', True)]}),
'is_attendee': fields.function(_compute, string='Attendee', type="boolean", multi='attendee'),
'attendee_status': fields.function(_compute, string='Attendee Status', type="selection", multi='attendee'),
'display_time': fields.function(_compute, string='Event Time', type="char", multi='attendee'),
# ---------------------
# OLD CALENDAR_EVENT
# ---------------------
'id': fields.integer('ID', readonly=True),
'sequence': fields.integer('Sequence'),
'date': fields.datetime('Date', states={'done': [('readonly', True)]}, required=True,track_visibility='onchange'),
@ -1046,18 +1044,6 @@ class crm_meeting(osv.Model):
return {'value': value}
# def unlink_events(self, cr, uid, ids, context=None):
# """
# This function deletes event which are linked with the event with recurrent_id
# (Removes the events which refers to the same UID value)
# """
# if context is None:
# context = {}
# for event_id in ids:
# r_ids = self.search(cr,uid,[('recurrent_id','=',event_id)],context=context)
# self.unlink(cr, uid, r_ids, context=context)
# return True
def new_invitation_token(self, cr, uid, record, partner_id):
db_uuid = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
invitation_token = hashlib.sha256('%s-%s-%s-%s-%s' % (time.time(), db_uuid, record._name, record.id, partner_id)).hexdigest()
@ -1468,12 +1454,10 @@ class crm_meeting(osv.Model):
return res
def write(self, cr, uid, ids, values, context=None):
print "Write : ",ids
print values
def _only_changes_to_apply_on_real_ids(field_names):
''' return True if changes are only to be made on the real ids'''
for field in field_names:
if field not in ['message_follower_ids']:
if field not in ['name','message_follower_ids']:
return False
return True
@ -1567,11 +1551,8 @@ class crm_meeting(osv.Model):
if vals.get('recurrency', True) and vals.get('end_type', 'count') in ('count', unicode('count')) and \
(vals.get('rrule_type') or vals.get('count') or vals.get('date') or vals.get('date_deadline')):
vals['end_date'] = self._get_recurrency_end_date(vals, context=context)
print "CREATE WITH VALUES",vals
res = super(crm_meeting, self).create(cr, uid, vals, context=context)
#res = self.write(cr, uid, id_res,vals, context)
self.create_attendees(cr, uid, [res], context=context)
return res
@ -1683,16 +1664,16 @@ class crm_meeting(osv.Model):
return super(crm_meeting, self).search(cr, uid, domain, context=context)
def delete(self,cr,uid,ids,context=None):
if not isinstance(ids, list):
ids = [ids]
all_ids = []
for id_to_unlink in ids:
all_ids += self.get_linked_ids(cr, uid, id_to_unlink, context=context)
print "in deleTe functIon === ids : %s, all_ids : %s" % (ids,all_ids)
all_ids = list(set(all_ids))
res = super(crm_meeting, self).unlink(cr, uid, all_ids, context=context)
return all_ids
# def delete(self,cr,uid,ids,context=None):
# if not isinstance(ids, list):
# ids = [ids]
# all_ids = []
# for id_to_unlink in ids:
# all_ids += self.get_linked_ids(cr, uid, id_to_unlink, context=context)
# print "in deleTe functIon === ids : %s, all_ids : %s" % (ids,all_ids)
# all_ids = list(set(all_ids))
# res = super(crm_meeting, self).unlink(cr, uid, all_ids, context=context)
# return all_ids
def unlink(self, cr, uid, ids,unlink_level=0, context=None):
@ -1706,15 +1687,14 @@ class crm_meeting(osv.Model):
#One time moved to google_Calendar, we can specify, an if not in google, and not rec or get_inst = 0, we delete it
for event_id in ids:
#if unlink_level == 1 and len(str(event_id).split('-')) == 1: ## if ID REAL
if unlink_level == 1 and len(str(event_id).split('-')) == 1: ## if ID REAL
if self.browse(cr,uid,event_id).recurrent_id:
print "Could not be deleted ! because instance of recursive"
# print "Could not be deleted ! because instance of recursive"
ids_to_exclure.append(event_id)
else:
ids_to_unlink.append(event_id)
else:
print "Could not be deleted ! because instance virtual"
#print "Could not be deleted ! because instance virtual"
ids_to_exclure.append(event_id)

View File

@ -10,7 +10,7 @@
<field name="name">Another Partner</field>
<field name="company_id" ref="base.main_company"/>
<field name="customer" eval="False"/>
<field name="email">another@partner.com</field>
<field name="email">another_partner@example.com</field>
</record>
<record id="res_user_another" model="res.users">
<field name="name" >Another User</field>

View File

@ -27,6 +27,18 @@
!python {model: crm.meeting}: |
ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
assert len(ids) == 9, 'Wrong number of events found'
-
Now I move a virtual event, to see that a real event is well created and depending from the native recurrence
-
!python {model: crm.meeting}: |
ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
before = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': False})
self.write(cr, uid,[ids[1]], {'name':'New Name','recurrency' : True}, context={'virtual_id': True})
after = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': False})
assert len(after) == len(before)+1, 'Wrong number of events found, after to have moved a virtual event'
new_id = list(set(after)-set(before))[0]
new_event = self.browse(cr,uid,new_id,context=context)
assert new_event.recurrent_id == before[0], 'Recurrent_id not correctly passed to the new event'
-
Now I will make All day event and test it
-
@ -41,14 +53,14 @@
-
In order to check reminder I will first create reminder
-
!record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}:
!record {model: calendar.alarm, id: res_alarm_daybeforeeventstarts0}:
name: 1 Day before event starts
trigger_duration: 1
trigger_interval: days
trigger_occurs: before
trigger_related: start
duration: 1
interval: days
type: notification
-
Now I will assign this reminder to all day event
-
!python {model: crm.meeting}: |
self.write(cr, uid, [ref("crm_meeting_alldaytestevent0")], {'alarm_id': ref("res_alarm_daybeforeeventstarts0")})
self.write(cr, uid, [ref("crm_meeting_alldaytestevent0")], {'alarm_ids': [(6,0,[ref("res_alarm_daybeforeeventstarts0")])]})

View File

@ -70,9 +70,8 @@
I change name of my monthly Sprint Review meeting.
-
!python {model: crm.meeting}: |
from base_calendar import base_calendar
base_cal_id = base_calendar.real_id2base_calendar_id(ref('crm_meeting_sprintreview0'), '2011-09-01 13:01:00')
self.write(cr, uid, [base_cal_id], {'name': 'Sprint Review for google modules'})
idval = '%d-%s' % (ref('crm_meeting_sprintreview0'), '20110901130100')
self.write(cr, uid, [idval], {'name': 'Sprint Review for google modules'})
-
I check whether all the records are edited or not.
-
@ -85,13 +84,13 @@
I change description of my weekly meeting Review code with programmer.
-
!python {model: crm.meeting}: |
from base_calendar import base_calendar
base_cal_id = base_calendar.real_id2base_calendar_id(ref('crm_meeting_reviewcodewithprogrammer0'), '2011-04-25 12:47:00')
self.write(cr, uid, [base_cal_id], {'description': 'Review code of the module: sync_google_calendar.'})
idval = '%d-%s' % (ref('crm_meeting_sprintreview0'), '20110425124700')
self.write(cr, uid, [idval], {'description': 'Review code of the module: sync_google_calendar.'})
-
I check whether the record is edited perfectly or not.
-
!python {model: crm.meeting}: |
meeting_ids = self.search(cr, uid, [('recurrent_id', '=', ref('crm_meeting_reviewcodewithprogrammer0')), ('recurrent_id_date','=','2011-04-25 12:47:00')], context)
meeting_ids = self.search(cr, uid, [('recurrent_id', '=', ref('crm_meeting_sprintreview0')), ('recurrent_id_date','=','2011-04-25 12:47:00')], context)
print ref('crm_meeting_reviewcodewithprogrammer0'),meeting_ids
assert meeting_ids, 'Meeting is not edited !'

View File

@ -308,7 +308,7 @@ class google_calendar(osv.osv):
response = self.create_an_event(cr,uid,att.event_id,context=context)
update_date = datetime.strptime(response['updated'],"%Y-%m-%dT%H:%M:%S.%fz")
crm_meeting.write(cr, uid, att.event_id.id, {'oe_update_date':update_date})
att_obj.write(cr, uid, [att.id], {'google_internal_event_id': response['id'], 'oe_syncro_date':update_date})
att_obj.write(cr, uid, [att.id], {'google_internal_event_id': response['id'], 'oe_synchro_date':update_date})
#Check that response OK and return according to that
cr.commit()
return True
@ -723,7 +723,7 @@ class calendar_attendee(osv.osv):
_inherit = 'calendar.attendee'
_columns = {
'google_internal_event_id': fields.char('Google Calendar Event Id', size=124),
'google_internal_event_id': fields.char('Google Calendar Event Id', size=256),
'oe_synchro_date': fields.datetime('OpenERP Synchro Date'),
}