@@ -15,7 +15,8 @@
|
||||
Now I will set recurrence for this event to occur monday and friday of week
|
||||
-
|
||||
!python {model: calendar.event}: |
|
||||
self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly'})
|
||||
data = {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly', 'end_type': 'end_date', 'end_date': '2011-05-31 00:00:00'}
|
||||
self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], data)
|
||||
- |
|
||||
In order to check that recurrent events are views successfully in calendar view,
|
||||
I will open calendar view of events
|
||||
@@ -27,7 +28,7 @@
|
||||
I will search for one of the recurrent event and count the number of events
|
||||
-
|
||||
!python {model: calendar.event}: |
|
||||
ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')] )
|
||||
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
|
||||
- |
|
||||
Now I will make All day event and test it
|
||||
|
||||
@@ -129,6 +129,7 @@ Creates a dashboard for CRM that includes:
|
||||
'test/test_crm_phonecall.yml',
|
||||
'test/test_crm_recurrent_meeting.yml',
|
||||
'test/test_crm_stage_changes.yml',
|
||||
'test/test_crm_recurrent_meeting_case2.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
!python {model: crm.meeting}: |
|
||||
import time
|
||||
from datetime import datetime, date, timedelta
|
||||
ids = self.search(cr, uid, [('date', '>=', time.strftime('%Y-%m-%d 00:00:00')), ('date', '<=', (datetime.now()+timedelta(31)).strftime('%Y-%m-%d 00:00:00')), ('name', '=', 'Regarding Presentation')] )
|
||||
ids = self.search(cr, uid, [('date', '>=', time.strftime('%Y-%m-%d 00:00:00')), ('date', '<=', (datetime.now()+timedelta(31)).strftime('%Y-%m-%d 00:00:00')), ('name', '=', 'Regarding Presentation')], context={'virtual_id': True})
|
||||
assert len(ids) == 10
|
||||
|
||||
- |
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
-
|
||||
In order to test recurrent meetings in OpenERP, I create meetings with different recurrency using different test cases.
|
||||
-
|
||||
I create a recurrent meeting with daily recurrency and fixed amount of time.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_testmeeting0}:
|
||||
count: 5
|
||||
date: '2011-04-13 11:04:00'
|
||||
date_deadline: '2011-04-13 12:04:00'
|
||||
day: 0.0
|
||||
duration: 1.0
|
||||
name: Test Meeting
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule_type: daily
|
||||
sequence: 0.0
|
||||
-
|
||||
I search for all the recurrent meetings.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_testmeeting0')]),('date','>=','2011-03-13'), ('date_deadline', '<=', '2011-05-13')], context={'virtual_id': True})
|
||||
assert len(meeting_ids) == 5, 'Recurrent daily meetings are not created !'
|
||||
-
|
||||
Now I create a weekly meeting till a particular end date.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_reviewcodewithprogrammer0}:
|
||||
date: '2011-04-18 11:47:00'
|
||||
date_deadline: '2011-04-18 12:47:00'
|
||||
day: 0.0
|
||||
duration: 1.0
|
||||
end_date: '2011-04-30'
|
||||
end_type: end_date
|
||||
fr: true
|
||||
mo: true
|
||||
th: true
|
||||
tu: true
|
||||
we: true
|
||||
name: Review code with programmer
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule_type: weekly
|
||||
sequence: 0.0
|
||||
-
|
||||
I search for all the recurrent weekly meetings.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_reviewcodewithprogrammer0')]),('date','>=','2011-03-13'), ('date_deadline', '<=', '2011-05-13')], context={'virtual_id': True})
|
||||
assert len(meeting_ids) == 10, 'Recurrent weekly meetings are not created !'
|
||||
-
|
||||
I want to schedule a meeting every month for Sprint review.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_sprintreview0}:
|
||||
count: 12
|
||||
date: '2011-04-01 12:01:00'
|
||||
date_deadline: '2011-04-01 13:01:00'
|
||||
day: 1
|
||||
duration: 1.0
|
||||
name: Sprint Review
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule_type: monthly
|
||||
sequence: 0.0
|
||||
-
|
||||
I search for all the recurrent monthly meetings.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_sprintreview0')]),('date','>=','2011-03-01'), ('date_deadline', '<=', '2012-05-13')], context={'virtual_id': True})
|
||||
assert len(meeting_ids) == 12, 'Recurrent monthly meetings are not created !'
|
||||
-
|
||||
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', 'edit_all': True})
|
||||
-
|
||||
I check whether all the records are edited or not.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_sprintreview0')]),('date','>=','2011-03-01'), ('date_deadline', '<=', '2012-05-13')], context={'virtual_id': True})
|
||||
meetings = self.browse(cr, uid, meeting_ids, context)
|
||||
for meeting in meetings:
|
||||
assert meeting.name == 'Sprint Review for google modules', 'Name not changed for id: %s' %meeting.id
|
||||
-
|
||||
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.'})
|
||||
-
|
||||
I check whether the record is edited perfectly or not.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
meeting_ids = self.search(cr, uid, [('recurrent_uid', '=', ref('crm_meeting_reviewcodewithprogrammer0')), ('recurrent_id','=','2011-04-25 12:47:00')], context)
|
||||
assert meeting_ids, 'Meeting is not edited !'
|
||||
|
||||
|
||||
@@ -75,8 +75,12 @@ class google_login(osv.osv_memory):
|
||||
'gmail_password': password
|
||||
}
|
||||
self.pool.get('res.users').write(cr, uid, uid, res, context=context)
|
||||
except :
|
||||
raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
|
||||
except Exception, e:
|
||||
if len(e.args) > 1:
|
||||
msg = e.args[1]
|
||||
else:
|
||||
msg = e.args[0]
|
||||
raise osv.except_osv(_('Error'), _("%s" %msg))
|
||||
|
||||
return self._get_next_action(cr, uid, context=context)
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
'depends': ['base','google_base_account', 'crm'],
|
||||
'init_xml': [],
|
||||
'update_xml': ['wizard/wizard_import_calendar_events_view.xml', 'sync_google_calendar_view.xml'],
|
||||
'test': ['test/test_sync_google_calendar.yml'],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
-
|
||||
In order to test google calendar feature with OpenERP, I import events from
|
||||
a google account and store them in Meetings.
|
||||
- |
|
||||
I create a record for the gmail account for which I want to import the contacts.
|
||||
-
|
||||
!record {model: google.login, id: google_login_contact_id0}:
|
||||
user: testmail.openerp
|
||||
password: openerptiny
|
||||
- |
|
||||
I login into that account.
|
||||
-
|
||||
!python {model: google.login}: |
|
||||
self.check_login(cr, uid, [ref('google_login_contact_id0')], context)
|
||||
- |
|
||||
Now I want to import all the events from all the calendars in the user account.
|
||||
- |
|
||||
I select all calendars.
|
||||
-
|
||||
!record {model: synchronize.google.calendar, id: synchronize_google_calendar_id0}:
|
||||
calendar_name: all
|
||||
- |
|
||||
I import the events from the google calendar.
|
||||
-
|
||||
!python {model: synchronize.google.calendar}: |
|
||||
self.import_calendar_events(cr, uid, [ref('synchronize_google_calendar_id0')], context)
|
||||
- |
|
||||
Now I check my meetings are created or not.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
model_obj = self.pool.get('ir.model.data')
|
||||
meeting_ids = self.search(cr, uid, [])
|
||||
model_ids = model_obj.search(cr, uid, [('res_id','in',meeting_ids),('model','=','crm.meeting'),('module','=','sync_google_calendar')])
|
||||
assert model_ids, 'Meetings not created !'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user