title: attachments are not being saved on backend from website odoo 12
body: <p>I want to add attachment while edit a form named my information on website and i want to save the attachment on the backend. I have added input field in the form for attachment but while saving the form i am not getting the attachment in the backend.
  Here is my code:-</p>
  <p>template file:-</p>
  <pre><code>&lt;div class=&quot;form-group row&quot;&gt;
       &lt;div class=&quot;col-lg-3 col-md-4&quot;&gt;
        &lt;label class=&quot;control-label&quot; for=&quot;Attachments&quot;&gt;
         Attach Files
        &lt;/label&gt;
       &lt;/div&gt;
       &lt;div class=&quot;col-lg-7 col-md-12&quot;&gt;
         &lt;input id='attachment' type=&quot;file&quot;
         class=&quot;form-control o_website_form_input&quot;
         name=&quot;attachment&quot; multiple=&quot;true&quot;
         data-show-preview=&quot;true&quot;                                                                          
         accept=&quot;application/pdf&quot;/&gt;
        &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>controller file:-</p>
  <pre><code>@route(['/path/to/template'], type='http', auth='public', website=True)
  def account(self, redirect=None, **post):
      values = self._prepare_portal_layout_values()
      User = request.env.user
      partner = User.partner_id
      
      if post:
  
          print(&quot;post::::::::::::::::::::::&quot;, post, values)
          attachment_ids = []
          attachment_list = request.httprequest.files.getlist('attachment')
          print(&quot;attachment_list::::::::::::::::&quot;, attachment_list)
          for att in attachment_list:
              if post.get('attachment'):
                  attachments = {
                      'res_name': att.filename,
                      'res_model': 'res.partner',
                      'res_id': partner.sudo().id,
                      'datas': base64.encodestring(att.read()),
                      'type': 'binary',
                      'datas_fname': att.filename,
                      'name': att.filename,
                  }
                  attachment_obj = http.request.env['ir.attachment']
                  att_record = attachment_obj.sudo().create(attachments)
                  attachment_ids.append(att_record.id)
          if attachment_ids:
              values.update({'attachment_ids': [(6, 0, attachment_ids)]})
  </code></pre>
  <p>So Can anyone give me some idea what i am missing?</p>