hunk.code_window:         """ Make entry on email and availability on change of partner_id field. """
           self.email = self.partner_id.email
       @api.model
       def create(self, values):
           if not values.get("email") and values.get("cn"):
               cnval = values.get("cn").split(':')
               email = filter(lambda x: x.__contains__('@'), cnval)  # TODO JEM : should be refactored
               values['email'] = email and email[0] or ''
  
hunk.labels: keep keep keep keep keep replace replace replace keep
hunk.after_edit:         if not values.get("email") and values.get("common_name"):
               common_nameval = values.get("common_name").split(':')
               email = filter(lambda x: x.__contains__('@'), common_nameval)  # TODO JEM : should be refactored
  
hunk.file_path: addons/calendar/models/calendar.py
hunk.type: replace
file: <?xml version="1.0"?>
  <odoo>
      <data noupdate="1">
  
           <!-- Expense-related subtypes for messaging / Chatter -->
          <record id="calendar.subtype_invitation" model="mail.message.subtype">
              <field name="name">Invitation</field>
              <field name="res_model">calendar.event</field>
              <field name="description" eval="False"/>
              <field name="default" eval="False"/>
          </record>
          <record id="alarm_notif_1" model="calendar.alarm">
              <field name="name">15 Minute(s)</field>
              <field name="duration" eval="15" />
              <field name="interval">minutes</field>
              <field name="type">notification</field>
          </record>
          <record id="alarm_notif_2" model="calendar.alarm">
              <field name="name">30 Minute(s)</field>
              <field name="duration" eval="30" />
              <field name="interval">minutes</field>
              <field name="type">notification</field>
          </record>
          <record id="alarm_notif_3" model="calendar.alarm">
              <field name="name">1 Hour(s)</field>
              <field name="duration" eval="1" />
              <field name="interval">hours</field>
              <field name="type">notification</field>
          </record>
          <record id="alarm_notif_4" model="calendar.alarm">
              <field name="name">2 Hour(s)</field>
              <field name="duration" eval="2" />
              <field name="interval">hours</field>
              <field name="type">notification</field>
          </record>
          <record id="alarm_notif_5" model="calendar.alarm">
              <field name="name">1 Day(s)</field>
              <field name="duration" eval="1" />
              <field name="interval">days</field>
              <field name="type">notification</field>
          </record>
          <record id="alarm_mail_1" model="calendar.alarm">
              <field name="name">2~3 Hour(s) mail</field>
              <field name="duration" eval="3" />
              <field name="interval">hours</field>
              <field name="type">email</field>
          </record>
          <record id="alarm_mail_2" model="calendar.alarm">
              <field name="name">5~6 Hour(s) mail</field>
              <field name="duration" eval="6" />
              <field name="interval">hours</field>
              <field name="type">email</field>
          </record>
  
          <record id="categ_meet1" model="calendar.event.type">
              <field name="name">Customer Meeting</field>
          </record>
  
          <record id="categ_meet2" model="calendar.event.type">
              <field name="name">Internal Meeting</field>
          </record>
  
          <record id="categ_meet3" model="calendar.event.type">
              <field name="name">Off-site Meeting</field>
          </record>
  
          <record id="categ_meet4" model="calendar.event.type">
              <field name="name">Open Discussion</field>
          </record>
  
          <record id="categ_meet5" model="calendar.event.type">
              <field name="name">Feedback Meeting</field>
          </record>
  
          <record id="calendar_template_meeting_invitation" model="mail.template">
              <field name="name">Calendar: Meeting Invitation</field>
              <field name="email_from">${object.event_id.user_id.email or ''}</field>
              <field name="subject">${object.event_id.name} invitation</field>
              <field name="model_id" ref="calendar.model_calendar_attendee"/>
              <field name="email_to" >${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}</field>
              <field name="partner_to">${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }</field>
              <field name="auto_delete" eval="True"/>
              <field name="body_html"><![CDATA[
  % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00',  'declined': 'red'}
  <div summary="o_mail_template" style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="center" width="200" style="padding:10px 10px 10px 5px;font-size: 12px">
                  <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
              </td>
              <td valign="center" align="right" width="340" style="padding:10px 10px 10px 5px; font-size: 12px;">
                  <p>
                      <a href="/calendar/meeting/accept?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Accept</a>
                      <a href="/calendar/meeting/decline?db=${'dbname' in ctx and ctx['dbname'] or '' }&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Decline</a>
                      <a href="/calendar/meeting/view?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">View</a>
                  </p>
              </td>
          </tr></tbody>
      </table>
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="top" style="width:600px; padding:10px 10px 10px 5px;">
                  <div>
                      <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0;margin:15px auto;padding:0">
                  </div>
              </td>
          </tr></tbody>
      </table>
  </div>
  <div style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td style="padding:10px 10px 10px 5px;font-size: 14px;">
                  <p style="font-size: 20px; text-align: center;">Invitation to <strong>${object.event_id.name}</strong></p>
                  <p>
                      <strong>Dear ${object.cn}</strong>,<br />
                      ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.</p>
                  <table style="margin-top: 20px;"><tr>
                      <td>
                          <div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
                              ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style="font-size:48px;min-height:auto;font-weight:bold;text-align:center;color: #5F5F5F;background-color: #F8F8F8;width: 130px;border:1px solid #a24689;">
                              ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style='font-size:12px;text-align:center;font-weight:bold;color:#ffffff;background-color:#a24689'>${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}</div>
                          <div style="border-collapse:separate;color: #5F5F5F;text-align:center;width: 130px;font-size:12px;border-bottom-right-radius:3px;font-weight:bold;border:1px solid #a24689;border-bottom-left-radius:3px;">${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}</div>
                      </td>
                      <td width="20px;"/>
                      <td>
                          <p>Details of the event</p>
                          <ul>
                          % if object.event_id.location:
                              <li>Location: ${object.event_id.location}
                              (<a href="http://maps.google.com/maps?oi=map&q=${object.event_id.location}">View Map</a>)
                              </li>
                          % endif
                          % if object.event_id.description :
                              <li>Description: ${object.event_id.description}</li>
                          % endif
                          % if not object.event_id.allday and object.event_id.duration
                              <li>Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}</li>
                          % endif
                          <li>Attendees
                          <ul>
                          % for attendee in object.event_id.attendee_ids:
                              <li>
                                  <div style="display:inline-block; border-radius: 50%; width:10px; height:10px;background:${colors[attendee.state] or 'white'};"></div>
                                  % if attendee.cn != object.cn:
                                  <span style="margin-left:5px">${attendee.cn}</span>
                                  % else:
                                  <span style="margin-left:5px">You</span>
                                  % endif
                              </li>
                          % endfor
                          </ul></li>
                          </ul>
                      </td>
                  </tr></table>
              </td>
          </tr></tbody>
      </table>
  </div>]]></field>
          </record>
  
          <record id="calendar_template_meeting_changedate" model="mail.template">
              <field name="name">Calendar: Date updated</field>
              <field name="email_from">${object.event_id.user_id.email or ''}</field>
              <field name="subject">${object.event_id.name}: Date updated</field>
              <field name="model_id" ref="calendar.model_calendar_attendee"/>
              <field name="email_to" >${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}</field>
              <field name="partner_to">${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }</field>
              <field name="auto_delete" eval="True"/>
              <field name="body_html"><![CDATA[
  % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00',  'declined': 'red'}
  <div summary="o_mail_template" style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="center" width="200" style="padding:10px 10px 10px 5px;font-size: 12px">
                  <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
              </td>
              <td valign="center" align="right" width="340" style="padding:10px 10px 10px 5px; font-size: 12px;">
                  <p>
                      <a href="/calendar/meeting/accept?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Accept</a>
                      <a href="/calendar/meeting/decline?db=${'dbname' in ctx and ctx['dbname'] or '' }&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Decline</a>
                      <a href="/calendar/meeting/view?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">View</a>
                  </p>
              </td>
          </tr></tbody>
      </table>
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="top" style="width:600px; padding:10px 10px 10px 5px;">
                  <div>
                      <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0;margin:15px auto;padding:0">
                  </div>
              </td>
          </tr></tbody>
      </table>
  </div>
  <div style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td style="padding:10px 10px 10px 5px;font-size: 14px;">
                  <p style="font-size: 20px; text-align: center;"><strong>${object.event_id.name} date updated</strong></p>
                  <p>
                      <strong>Dear ${object.cn}</strong>,<br />
                      The date of the meeting has been upated. The meeting  ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
                  </p>
                  <table style="margin-top: 20px;"><tr>
                      <td>
                          <div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
                              ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style="font-size:48px;min-height:auto;font-weight:bold;text-align:center;color: #5F5F5F;background-color: #F8F8F8;width: 130px;border:1px solid #a24689;">
                              ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style='font-size:12px;text-align:center;font-weight:bold;color:#ffffff;background-color:#a24689'>${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}</div>
                          <div style="border-collapse:separate;color: #5F5F5F;text-align:center;width: 130px;font-size:12px;border-bottom-right-radius:3px;font-weight:bold;border:1px solid #a24689;border-bottom-left-radius:3px;">${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}</div>
                      </td>
                      <td width="20px;"/>
                      <td>
                          <p>Details of the event</p>
                          <ul>
                          % if object.event_id.location:
                              <li>Location: ${object.event_id.location}
                              (<a href="http://maps.google.com/maps?oi=map&q=${object.event_id.location}">View Map</a>)
                              </li>
                          % endif
                          % if object.event_id.description :
                              <li>Description: ${object.event_id.description}</li>
                          % endif
                          % if not object.event_id.allday and object.event_id.duration
                              <li>Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}</li>
                          % endif
                          <li>Attendees
                          <ul>
                          % for attendee in object.event_id.attendee_ids:
                              <li>
                                  <div style="display:inline-block; border-radius: 50%; width:10px; height:10px;background:${colors[attendee.state] or 'white'};"></div>
                                  % if attendee.cn != object.cn:
                                  <span style="margin-left:5px">${attendee.cn}</span>
                                  % else:
                                  <span style="margin-left:5px">You</span>
                                  % endif
                              </li>
                          % endfor
                          </ul></li>
                          </ul>
                      </td>
                  </tr></table>
              </td>
          </tr></tbody>
      </table>
  </div>]]></field>
          </record>
  
          <record id="calendar_template_meeting_reminder" model="mail.template">
              <field name="name">Calendar: Reminder</field>
              <field name="email_from">${object.event_id.user_id.email or ''}</field>
              <field name="subject">${object.event_id.name} - Reminder</field>
              <field name="model_id" ref="calendar.model_calendar_attendee"/>
              <field name="email_to" >${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}</field>
              <field name="partner_to">${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }</field>
              <field name="auto_delete" eval="True"/>
              <field name="body_html"><![CDATA[
  % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00',  'declined': 'red'}
  <div summary="o_mail_template" style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="center" width="200" style="padding:10px 10px 10px 5px;font-size: 12px">
                  <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
              </td>
              <td valign="center" align="right" width="340" style="padding:10px 10px 10px 5px; font-size: 12px;">
                  <p>
                      <a href="/calendar/meeting/accept?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Accept</a>
                      <a href="/calendar/meeting/decline?db=${'dbname' in ctx and ctx['dbname'] or '' }&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">Decline</a>
                      <a href="/calendar/meeting/view?db=${'dbname' in ctx and ctx['dbname'] or ''}&token=${object.access_token}&action=${'action_id' in ctx and ctx['action_id'] or ''}&id=${object.event_id.id}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px">View</a>
                  </p>
              </td>
          </tr></tbody>
      </table>
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td valign="top" style="width:600px; padding:10px 10px 10px 5px;">
                  <div>
                      <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0;margin:15px auto;padding:0">
                  </div>
              </td>
          </tr></tbody>
      </table>
  </div>
  <div style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
      <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
          <tbody><tr>
              <td style="padding:10px 10px 10px 5px;font-size: 14px;">
                  <p style="font-size: 20px; text-align: center;">Reminder for <strong>${object.event_id.name}</strong></p>
                  <p>
                      <strong>Dear ${object.cn}</strong>,<br />
                      This is a reminder for the below event :
                  </p>
                  <table style="margin-top: 20px;"><tr>
                      <td>
                          <div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
                              ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style="font-size:48px;min-height:auto;font-weight:bold;text-align:center;color: #5F5F5F;background-color: #F8F8F8;width: 130px;border:1px solid #a24689;">
                              ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
                          </div>
                          <div style='font-size:12px;text-align:center;font-weight:bold;color:#ffffff;background-color:#a24689'>${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}</div>
                          <div style="border-collapse:separate;color: #5F5F5F;text-align:center;width: 130px;font-size:12px;border-bottom-right-radius:3px;font-weight:bold;border:1px solid #a24689;border-bottom-left-radius:3px;">${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}</div>
                      </td>
                      <td width="20px;"/>
                      <td>
                          <p>Details of the event</p>
                          <ul>
                          % if object.event_id.location:
                              <li>Location: ${object.event_id.location}
                              (<a href="http://maps.google.com/maps?oi=map&q=${object.event_id.location}">View Map</a>)
                              </li>
                          % endif
                          % if object.event_id.description :
                              <li>Description: ${object.event_id.description}</li>
                          % endif
                          % if not object.event_id.allday and object.event_id.duration
                              <li>Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}</li>
                          % endif
                          <li>Attendees
                          <ul>
                          % for attendee in object.event_id.attendee_ids:
                              <li>
                                  <div style="display:inline-block; border-radius: 50%; width:10px; height:10px;background:${colors[attendee.state] or 'white'};"></div>
                                  % if attendee.cn != object.cn:
                                  <span style="margin-left:5px">${attendee.cn}</span>
                                  % else:
                                  <span style="margin-left:5px">You</span>
                                  % endif
                              </li>
                          % endfor
                          </ul></li>
                          </ul>
                      </td>
                  </tr></table>
              </td>
          </tr></tbody>
      </table>
  </div>]]></field>
          </record>
      </data>
  </odoo>
  