title: Get field name in write method got error in odoo
body: <p>When I edit the sale order and save it, the credit and debit fields got a none type error. How can I solve it?</p>
  <p><em><strong>Python code:</strong></em></p>
  <pre><code>@api.model
  def create(self,vals):
      logging.info(&quot;create Mehtod+++++++++++++++++++++&quot;)
      logging.info(type(vals.get('credit')))
      if vals.get('credit') &lt; vals.get('debit'):
          vals['check'] = True 
          logging.info(&quot;Create fisrt++++++++++++++++&quot;)
      else:
          vals['check'] = False
          logging.info(&quot;Create second++++++++++++++&quot;)
      return super(sale_credit, self).create(vals)
  
  def write(self,vals):
      logging.info(&quot;Write Mehtod+++++++++++++++++++++++&quot;)
      # logging.info(vals['debit'])
      logging.info(type(vals.get('credit')))
      logging.info(vals)
  
      if vals['credit'] &gt;= vals['debit']:
          logging.info(&quot;FIrst write+++++++++++++&quot;)
          vals['check'] = False
      else:
          vals['check'] = True
      return super(sale_credit, self).write(vals)
  </code></pre>
  <p>I got this error log. I have the field credit and debit float field but I don't know why I got this error.</p>
  <pre><code>File &quot;/home/akkl/odoo13_ENTERPRISE/odoo13_5555/odoo13_5555-server/addons/web/controllers/main.py&quot;, line 1314, in _call_kw
      return call_kw(request.env[model], method, args, kwargs)
    File &quot;/home/akkl/odoo13_ENTERPRISE/odoo13_5555/odoo13_5555-server/odoo/api.py&quot;, line 387, in call_kw
      result = _call_kw_multi(method, model, args, kwargs)
    File &quot;/home/akkl/odoo13_ENTERPRISE/odoo13_5555/odoo13_5555-server/odoo/api.py&quot;, line 374, in _call_kw_multi
      result = method(recs, *args, **kwargs)
    File &quot;/home/akkl/UMG/customer_credit_limit/models/models.py&quot;, line 115, in write
      if vals['credit'] &gt;= vals['debit']:
  KeyError: 'credit'
  </code></pre>