[IMP] comments and whitespaces

bzr revid: abo@openerp.com-20121005114919-7rgseqg9f0y2cdvn
This commit is contained in:
Antonin Bourguignon 2012-10-05 13:49:19 +02:00
parent ec563e56da
commit f38d9ec3cd
3 changed files with 32 additions and 59 deletions

View File

@ -592,6 +592,7 @@ property or property parameter."),
vals['cn'] = vals.get("cn")
res = super(calendar_attendee, self).create(cr, uid, vals, context)
return res
calendar_attendee()
class res_alarm(osv.osv):
@ -990,7 +991,6 @@ class calendar_event(osv.osv):
super(calendar_event, obj).write(cr, uid, ids, data, context=context)
return True
_columns = {
'id': fields.integer('ID', readonly=True),
'sequence': fields.integer('Sequence'),
@ -1113,7 +1113,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
'user_id': lambda self, cr, uid, ctx: uid,
'organizer': default_organizer,
}
def _check_closing_date(self, cr, uid, ids, context=None):
for event in self.browse(cr, uid, ids, context=context):
if event.date_deadline < event.date:
@ -1140,7 +1140,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
result.append(data['id'])
continue
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
# To check: If the start date is replace by event date .. the event date will be changed by that of calendar code
# TOCHECK: the start date should be replaced by event date; the event date will be changed by that of calendar code
if not data['rrule']:
continue
@ -1248,19 +1249,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
'week_list' : False
}
#def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None):
# data = self._get_empty_rrule_data()
#
# if field_value:
# data['recurrency'] = True
# for event in self.browse(cr, uid, ids, context=context):
# rdate = rule_date or event.date
# update_data = self._parse_rrule(field_value, dict(data), rdate)
# data.update(update_data)
# #parse_rrule
# self.write(cr, uid, event.id, data, context=context)
def _parse_rrule(self, rule, data, date_start):
day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
rrule_type = ['yearly', 'monthly', 'weekly', 'daily']
@ -1278,7 +1266,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if i in r._byweekday:
data[day_list[i]] = True
data['rrule_type'] = 'weekly'
#repeat monthly bynweekday ((weekday, weeknumber), )
#repeat monthly by nweekday ((weekday, weeknumber), )
if r._bynweekday:
data['week_list'] = day_list[r._bynweekday[0][0]].upper()
data['byday'] = r._bynweekday[0][1]
@ -1290,7 +1278,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
data['select1'] = 'date'
data['rrule_type'] = 'monthly'
#yearly but for openerp it's monthly, take same information as monthly but interval is 12 times
#repeat yearly but for openerp it's monthly, take same information as monthly but interval is 12 times
if r._bymonth:
data['interval'] = data['interval'] * 12
@ -1363,7 +1351,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
except Exception:
return True
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
context = context or {}
if isinstance(ids, (str, int, long)):
@ -1384,14 +1371,14 @@ rule or repeating pattern of time to exclude from the recurring rule."),
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
'rrule', 'duration', 'exdate'])
if data.get('rrule'):
data.update(vals)
data.update({
'recurrent_uid': real_event_id,
'recurrent_id': data.get('date'),
'rrule_type': 'none',
'rrule': '',
'recurrency' : False,
})
data.update(
vals,
recurrent_uid=real_event_id,
recurrent_id=data.get('date'),
rrule_type='none',
rrule='',
recurrency=False,
)
new_id = self.copy(cr, uid, real_event_id, default=data, context=context)
@ -1435,7 +1422,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
return res
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
# FIXME This whole id mangling has to go!
if context is None:
context = {}
fields2 = fields and fields[:] or None
@ -1445,10 +1431,12 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if fields and (f not in fields):
fields2.append(f)
# FIXME This whole id mangling has to go!
if isinstance(ids, (str, int, long)):
select = [ids]
else:
select = ids
select = map(lambda x: (x, base_calendar_id2real_id(x)), select)
result = []
@ -1477,7 +1465,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if f not in ('id','date','date_deadline','duration','user_id','state'):
if isinstance(r[f], list):
r[f] = []
else:
else:
r[f] = False
if f=='name':
r[f] = _('Busy')
@ -1525,7 +1513,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
self.unlink_events(cr, uid, ids, context=context)
return res
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
@ -1770,5 +1757,4 @@ class res_users(osv.osv):
res_users()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Attendee form view-->
<!-- Attendee form view -->
<record id="base_calendar_attendee_form_view" model="ir.ui.view">
<field name="name">calendar.attendee.form</field>
<field name="model">calendar.attendee</field>
@ -55,8 +54,7 @@
</field>
</record>
<!-- Attendee tree view-->
<!-- Attendee tree view -->
<record id="base_calendar_attendee_tree_view" model="ir.ui.view">
<field name="name">calendar.attendee.tree</field>
<field name="model">calendar.attendee</field>
@ -73,8 +71,7 @@
</field>
</record>
<!-- Attendee search view-->
<!-- Attendee search view -->
<record id="base_calendar_attendee_search_view" model="ir.ui.view">
<field name="name">calendar.attendee.search</field>
<field name="model">calendar.attendee</field>
@ -110,18 +107,16 @@
<field name="context">{'default_sent_by_uid': uid}</field>
</record>
<!-- Calenadar's menu -->
<!-- Calendar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="50" groups="base.group_no_one"/>
<!-- Invitation menu -->
<menuitem id="menu_attendee_invitations"
parent="base.menu_calendar_configuration"
sequence="10" action="action_view_attendee_form"/>
<!-- ALARM FORM VIEW-->
<!-- Alarm form view -->
<record id="res_alarm_form_view" model="ir.ui.view">
<field name="name">res.alarm.form</field>
<field name="model">res.alarm</field>
@ -140,8 +135,7 @@
</field>
</record>
<!-- ALARM TREE VIEW-->
<!-- Alarm list view -->
<record id="res_alarm_tree_view" model="ir.ui.view">
<field name="name">res.alarm.tree</field>
<field name="model">res.alarm</field>
@ -171,15 +165,13 @@
</field>
</record>
<!-- Menu for Alarms-->
<!-- Alarms menu -->
<menuitem id="menu_crm_meeting_avail_alarm"
groups="base.group_no_one"
action="base_calendar.action_res_alarm_view"
parent="base.menu_calendar_configuration" sequence="5"/>
<!-- Event Form View-->
<!-- Event form view -->
<record model="ir.ui.view" id="event_form_view">
<field name="name">Event Form</field>
<field name="model">calendar.event</field>
@ -334,8 +326,7 @@
</field>
</record>
<!-- Event Tree View -->
<!-- Event list view -->
<record model="ir.ui.view" id="event_tree_view">
<field name="name">Event Tree</field>
<field name="model">calendar.event</field>
@ -352,8 +343,7 @@
</field>
</record>
<!-- Event Calendar View -->
<!-- Event calendar view -->
<record model="ir.ui.view" id="event_calendar_view">
<field name="name">Events Calendar</field>
<field name="model">calendar.event</field>
@ -367,8 +357,7 @@
</field>
</record>
<!-- Event Search View-->
<!-- Event search view -->
<record id="view_calendar_event_filter" model="ir.ui.view">
<field name="name">Calendar Events Search</field>
<field name="model">calendar.event</field>
@ -393,8 +382,7 @@
</record>
<!-- Event action -->
<!-- Event action -->
<record id="action_view_event" model="ir.actions.act_window">
<field name="name">Events</field>
<field name="type">ir.actions.act_window</field>
@ -404,8 +392,7 @@
<field name="search_view_id" ref="view_calendar_event_filter"/>
</record>
<!-- Event menu -->
<!-- Event menu -->
<menuitem id="menu_events"
name="Events" parent="base.menu_calendar_configuration"
sequence="15" action="action_view_event"/>

View File

@ -43,14 +43,14 @@ class crm_meeting(base_state, osv.Model):
_name = 'crm.meeting'
_description = "Meeting"
_order = "id desc"
_inherit = ["calendar.event", "mail.thread", 'ir.needaction_mixin']
_inherit = ["calendar.event", "mail.thread", "ir.needaction_mixin"]
_columns = {
# base_state required fields
'create_date': fields.datetime('Creation Date', readonly=True),
'write_date': fields.datetime('Write Date', readonly=True),
'date_open': fields.datetime('Confirmed', readonly=True),
'date_closed': fields.datetime('Closed', readonly=True),
'partner_ids': fields.many2many('res.partner', 'crm_meeting_partner_rel', 'meeting_id','partner_id',
'partner_ids': fields.many2many('res.partner', 'crm_meeting_partner_rel', 'meeting_id', 'partner_id',
string='Attendees', states={'done': [('readonly', True)]}),
'state': fields.selection(
[('draft', 'Unconfirmed'), ('open', 'Confirmed')],