title: Odoo error when calling Javascript function: Cannot read property 'then' of undefined
body: <p>I'm developing an Odoo module in which I add a button to existing module, this button when clicked should execute a certain function.
  Whenever I click this button, the function executes as desired but later I get an error:
  <strong>Cannot read property 'then' of undefined</strong></p>
  
  <p>The button definition in the view:</p>
  
  <pre><code>&lt;button onclick="myclick()"&gt;Click me&lt;/button&gt;
  </code></pre>
  
  <p>The JS Code (after simplification):</p>
  
  <pre><code>function myclick()
  {
  console.log("hi");
  }
  </code></pre>
  
  <p>What I tried:</p>
  
  <ul>
  <li>I simplified the code as much as I could but still the error appears.</li>
  <li>I researched the error and I got some results about <strong>promises</strong> but
  I still don't know how to resolve this error.</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/BANp2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BANp2.png" alt="enter image description here"></a></p>