title: How to code an update for extended field using server action on Odoo 11?
body: <p>I am learning Odoo 11 and want to code a button which will call a python method through a Server action.</p>
  
  <p>Here's my button code:</p>
  
  <pre><code>&lt;button name="enviarfactura" type="action" string="Homologar" attrs="{'invisible':['|',('sent','=',True), ('state', 'not in', ('open','paid'))]}"/&gt;
  </code></pre>
  
  <p>Here's my action.server code</p>
  
  <pre><code>&lt;record model="ir.actions.server" id="x_nc_act_serv_fact"&gt;
    &lt;field name="name"&gt;enviarfactura&lt;/field&gt;
    &lt;field name="model_id" ref="model_account_invoice"/&gt;
    &lt;field name="sequence"&gt;1&lt;/field&gt;
    &lt;field name="type"&gt;ir.actions.server&lt;/field&gt;
    &lt;field name="state"&gt;code&lt;/field&gt;
    &lt;field name="code"&gt;
              if records: 
                 action = records.x_nc_met_fac()
    &lt;/field&gt;
  &lt;/record&gt;
  </code></pre>
  
  <p>And finally here's my python method.</p>
  
  <pre><code>@api.multi
  def x_nc_met_fac(self):
  for rec in self:
      self.x_nc_fld_fact = True
      self.x_nc_fld_det_fact = 'my custom text'
  </code></pre>
  
  <p>Now the logic for this is that, the button will call the server.action which will call the method on my python class. The method will set new values for extended fields on the model account.invoice
  In theory this should work, but it doesn't. </p>
  
  <p>Discarding possible mistakes:</p>
  
  <p>-It's might not be the python indentation. The python community on discord help me with it :P
  -It's not the server.action structure since when I upload my module containing this code it creates the server.action without any problem.
  -When I click on the button, nothing happens.So i tried changing the type of the button to <code>"type=object"</code> and tell it the name of my method it gives the error. Account.invoice has no attribute "x_nc_met_fac"</p>
  
  <p>Any help is appreciated. Thanks in advance.</p>