title: Frappe not updating database
body: <p>please i am new to programming. i am working on a project on frappe. my database dont update. please can someone help me out</p>
  <p><strong>DETAILS OF THE PROBLEM</strong>
  i made a button on a doctype inventory_reconcilation the code is as follows
  //</p>
  <pre><code>frappe.ui.form.on('Inventory Reconciliation', {
      update_inventory: function(frm) {
          
          frappe.call({
              method: &quot;parkeyauto.api.reconcile_item_quantity&quot;,
              freeze:true,
              callback: (response) =&gt; {
                  console.log(response)
                                  
              }
              
          })
          
      }
  });
  </code></pre>
  <p>it is to call an api and update my database the api code is</p>
  <p>#from <em>future</em> import unicode_literals
  import frappe</p>
  <p>#http://localhost:8001/api/method/parkeyauto.api.reconcile_item_quantity</p>
  <pre><code>@frappe.whitelist()
  def reconcile_item_quantity():
      update_item_lists_to_zero_total()
     
  def update_item_lists_to_zero_total():      
      try:
          query = (&quot;SELECT item_name,initial_inventory_qty,po_qty, so_qty, damaged_qty, missing_qty, average_cost_price FROM _d101da5a9b48a4a9.`tabItem2`;&quot;)
          result_array = frappe.db.sql(query, as_dict=True)
          for detail in result_array:           
              item = frappe.get_doc('Item', detail.item_name)
              item.initial_inventory_qty = 0
              item.po_qty  = 0
              item.so_qty = 0
              item.damaged_qty = 0
              item.missing_qty  = 0
              item.average_cost_price = 0
              item.save()            
          return True
      except Exception as e:
          return e
   
  </code></pre>
  <p>please i need to know why my database is not updating.</p>