2 In Order to test base_calendar, I will first create One Simple Event with real data
4 !record {model: calendar.event, id: calendar_event_technicalpresentation0}:
6 date: '2011-04-30 16:00:00'
7 date_deadline: '2011-04-30 18:30:00'
8 description: The Technical Presentation will cover following topics:\n* Creating OpenERP
9 class\n* Views\n* Wizards\n* Workflows
11 location: OpenERP S.A.
12 name: Technical Presentation
14 Now I will set recurrence for this event to occur monday and friday of week
16 !python {model: calendar.event}: |
17 data = {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly', 'end_type': 'end_date', 'end_date': '2011-05-31 00:00:00', 'recurrency' : True}
18 self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], data)
20 In order to check that recurrent events are views successfully in calendar view, I will open calendar view of events
22 !python {model: calendar.event}: |
23 self.fields_view_get(cr, uid, False, 'calendar', context)
25 In order to check that recurrent events are views successfully in calendar view, I will search for one of the recurrent event and count the number of events
27 !python {model: calendar.event}: |
28 ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
29 assert len(ids) == 9, 'Wrong number of events found'
31 Now I will make All day event and test it
33 !record {model: calendar.event, id: calendar_event_alldaytestevent0}:
36 date: '2011-04-30 00:00:00'
37 date_deadline: '2011-04-30 00:00:00'
38 description: 'All day technical test '
40 name: All day test event
42 In order to check reminder I will first create reminder
44 !record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}:
45 name: 1 Day before event starts
47 trigger_interval: days
48 trigger_occurs: before
49 trigger_related: start
51 Now I will assign this reminder to all day event
53 !python {model: calendar.event}: |
54 self.write(cr, uid, [ref("calendar_event_alldaytestevent0")], {'alarm_id': ref("res_alarm_daybeforeeventstarts0")})
56 I create a recuring rule for my event
58 !record {model: crm.meeting, id: crm_meeting_sprintreview1}:
59 name: Begin of month meeting
60 date: !eval time.strftime('%Y-%m-%d 12:00:00')
62 rrule: FREQ=MONTHLY;INTERVAL=1;COUNT=12;BYDAY=1MO
64 I check that the attributes are set correctly
66 !assert {model: crm.meeting, id: crm_meeting_sprintreview1}:
67 - rrule_type == 'monthly'