title: how to modify fields of hr.attendance via a modification request automatically
body: <p>i'm using odoo 11. i have create a custom module for attendance modification request which be approuved by the manager of attendance . My goal is to limit the acces to the modification of attendance and when the manager press approuve "hr.attendance" will be modified automatically whith the new values of check_in and check_out (if it's the same employee and same date between "hr.attendance" and my request modification). The problem is when i press approuve there is no error but in the same time there is no modification.
  Here is my code. Any idea for help please ?</p>
  
  <p>modification_request.xml</p>
  
  <pre><code>&lt;record model="ir.ui.view" id="view_attendance_modification_request_form"&gt;
      &lt;field name="name"&gt;attendance.modification.request.form&lt;/field&gt;
      &lt;field name="model"&gt;attendance.modification.request&lt;/field&gt;
      &lt;field name="arch" type="xml"&gt;
          &lt;form string="Attendance modification Request"&gt;
              &lt;header&gt;
                  &lt;field name="state" statusbar_visible="draft,waiting,approved,cancel" widget="statusbar" /&gt;
                  &lt;button name="submit_modification" string="Submit for manager" type="object" class="btn-primary"
                          attrs="{'invisible': [('state','not in','draft')]}"/&gt;
                  &lt;button name="modification_approval" type="object" string="Approve" class="oe_highlight"
                          groups="hr_attendance.group_hr_attendance_manager"
                          attrs="{'invisible': [('state','not in','waiting')]}"/&gt;
                  &lt;button name="modification_rejection" type="object" string="Cancel" class="oe_highlight"
                          groups="hr_attendance.group_hr_attendance_manager"
                          attrs="{'invisible': [('state','not in','waiting')]}"/&gt;
              &lt;/header&gt;
              &lt;sheet&gt;
  
                  &lt;h2&gt;
                      &lt;group&gt;
  
                          &lt;field name="employee_id"/&gt;
                      &lt;/group&gt;
                  &lt;/h2&gt;
                  &lt;group  col="4" colspan="4"&gt;
                      &lt;field name="time_check_in_1"/&gt;
                      &lt;field name="time_check_out_1"/&gt;
                  &lt;/group&gt;
  
                  &lt;label for="note"/&gt;
                  &lt;field name="note"/&gt;
              &lt;/sheet&gt;
              &lt;field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/&gt;
              &lt;field name="activity_ids" widget="mail_activity"/&gt;
              &lt;field name="message_ids" widget="mail_thread"/&gt;
  
  
          &lt;/form&gt;
      &lt;/field&gt;
  &lt;/record&gt;
  </code></pre>
  
  <p>modification_request.py</p>
  
  <pre><code> class AttendanceModificationRequest(models.Model):
  _name = 'attendance.modification.request'
  _description = 'Attendance modification Request'
  _inherit = ['mail.thread', 'mail.activity.mixin']
  
  def _get_employee_id(self):
      employee_rec = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
      return employee_rec.id
  employee_id = fields.Many2one('hr.employee',"Employee", readonly=True,default=_get_employee_id, required=True)
  user_id = fields.Many2one('res.users', string='User', track_visibility='onchange', readonly=True,
                            states={'draft': [('readonly', False)]}, default=lambda self: self.env.user)
  state = fields.Selection([
      ('draft', 'Pending'),
      ('waiting', 'Waiting for approval'),
      ('approved', 'Approved'),
      ('cancel', 'Cancelled')], readonly=True,
      help="Gives the state of the attendance request modification .",
      default='draft')
  modification_date = fields.Date("Date")
  time_check_in_1 = fields.Datetime("Check in")
  time_check_out_1 = fields.Datetime("Check out")
  note = fields.Text("Note")
  attendance_id = fields.Many2one('hr.attendance', string='Attendance')
  @api.multi
  def modification_approval(self):
      attend_signin_ids = self.env['hr.attendance']
      check_in_date = datetime.strptime(self.time_check_in_1, "%Y-%m-%d %H:%M:%S").date()
      check_out_date = datetime.strptime(self.time_check_out_1, "%Y-%m-%d %H:%M:%S").date()
  
              for record in self:
                attendance_check_in_date = datetime.strptime(record.attendance_id.check_in, "%Y-%m-%d %H:%M:%S").date()
                attendance_check_out_date = datetime.strptime(record.attendance_id.check_out, "%Y-%m-%d %H:%M:%S").date()
                  if (record.attendance_id.employee_id == self.employee_id) and (check_in_date == attendance_check_in_date):
                     record.attendance_id.check_in = self.time_check_in_1
                     record.attendance_id.check_out = self.time_check_out_1
             return self.write({
          'state': 'approved'
      })
  </code></pre>