title: Odoo v8 form with WTForms
body: <p>I'm trying to accomplish this but I'm not sure how.</p>
  
  <p>Let's say I have form with two mandatory fields <code>name</code> and <code>partner_id</code></p>
  
  <p>On this form I have some other fields, which I want to fill from a website form, like this for example:</p>
  
  <pre><code>class CuidumForm(Form):
      name = StringField(_('Nombre periodical'),
          [Required(_('Please enter a name for the invoicing'))])
      nombre = StringField(_('Nombre'),
          [Required(_('Please enter a name for the Partner'))])
      n_seguridad_social = StringField(_('N de Seguridad Social'))#, [
      fecha_nacimiento = DateField(_('Fecha de nacimiento'),
          format='%d/%m/%Y', validators=(validators.Optional(),) )
      grado_discapacidad = StringField(_('Grado de discapacidad'))
      partner_id = SelectField(_('Country'), coerce=int)
  </code></pre>
  
  <p>My problem is, as I said before, that this module form, has <code>name</code> and <code>partner_id</code> as mandatory. So, everytime I create a new form like this, I'm creating a whole new register, while I just want to fill the other fields.</p>
  
  <p>What I'm confused at, is the fact that I should relate this website form to the form which is loading it, or, put it into another form, take <code>name</code> and <code>partner_id</code> as parameters of this form, and fill the other fields from <code>@route</code> in website.</p>
  
  <p>I don't know if I'm explaining very well, I need some example like this to complete my task.</p>
  
  <p>Somebody has an idea to where I should look for, or maybe a solution?</p>
  
  <p>I'm quite confused on how to do this.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have this controller, which loads the form on browser:</p>
  
  <pre><code>class Cuidum(Controller):
  
  @route('/contrato/crear', type='http', auth='public',website=True)
  def create(self, **post_data):
      form = CuidumForm(request.httprequest.form)
      form.partner_id.choices = [
          (partner.id, partner.name)
          for partner in request.env['res.partner'].search([])
      ]
      if request.httprequest.method == 'POST' and form.validate():
          request.env['account.periodical_invoicing.agreement'].create(dict([
              (field_name, field.data)
              for field_name, field in form._fields.iteritems()
          ]))
          return request.render(
              'website_create_partner.success',
              {'name': form.name.data})
      return request.render(
          'website_create_partner.contrato_new',
          {'form': form})
  </code></pre>
  
  <p>The key is here I guess:</p>
  
  <pre><code>form.partner_id.choices = [
      (partner.id, partner.name)
      for partner in request.env['res.partner'].search([])
  ]
  </code></pre>
  
  <p>How can I change this, from searching for a partner, to taking the actual <code>partner_id</code> which created the form?</p>
  
  <p><strong>SECOND EDIT</strong></p>
  
  <p>I'll try to explain myself better</p>
  
  <p>Let's say I have a form view in backend, this form view has the fields: <code>'name','partner_id','field_1','field_2','field_3'</code>, as I said <code>name</code> and <code>partner_id</code> are mandatory, so, all these fields, mandatory or not, can be filled from this form view, when you create or edit one, ok...</p>
  
  <p>Now, with this website form I'm creating, I just want to EDIT the backend form view, let's say from the form view, I have a button, this button loads the WTForm in website, with fields: <code>field_1,field_2,field_3</code> and taking as parameters the fields <code>name</code> and <code>partner_id</code>, and my problem now, is that the website form is just creating a new form view, not editing or updating the document.</p>
  
  <p>I should launch this WTForm froma button and I don't know, I should take a dict or a context with <code>name</code> and <code>partner_id</code> from where I'm launching it.</p>
  
  <p>I hope this explains my issue better.</p>