title: Update model from web controller Odoo v8
body: <p>I have this controller:</p>
  
  <pre><code>@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>And then this form from <code>WTForms</code>:</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>This logic, actually creates a new record on <code>account.periodical_invoicing.agreement</code> now, I'd like to Update records from this model instead of creating new ones, how can I achieve this?</p>
  
  <p>I'm really stuck on this one.</p>
  
  <p>I'll need to load this web form from a form view in backend, and attach the update to this form view.</p>
  
  <p>For example I load this with a button, from x form view in backend, it loads this web form with fields to update, then save and it saves it on the specific form view I was browsing.</p>
  
  <p>I'm sorry if this sounds noob, but I'm new to the Odoo v8 api, and I'm very confused at this one.</p>
  
  <p>Any ideas?</p>
  
  <p>Many Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I'm doing it like this, but it still creates a new record:</p>
  
  <pre><code>@route('/contrato/editar/', type='http', auth='public',website=True)
  def edit(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 == 'GET' and form.validate():
          request.env['account.periodical_invoicing.agreement'].update(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_editar',
          {'form': form})
  </code></pre>
  
  <p>And in my xml:</p>
  
  <pre><code>&lt;template id="contrato_editar" name="Edicion"&gt;
  &lt;t t-call="website.layout"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-6 col-md-offset-2"&gt;
              &lt;form role="form" action="/contrato/editar" method="GET"&gt;
                  &lt;t t-foreach="form" t-as="field"&gt;
                      &lt;t t-call="website_create_partner.field_render_cuidum" /&gt;
                  &lt;/t&gt;
                  &lt;button type="submit" class="btn btn-primary mt8"&gt;Guardar&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/t&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>I'm still confused, :(</p>