title: How to get value through rpc query?
body: <p>I have written a JS code to replace an existing function,
  here is <a href="https://stackoverflow.com/questions/63050344/patching-an-existing-js-function-but-still-show-up?noredirect=1#comment111512436_63050344">my previous question</a>.</p>
  <p>I have successfully replaced it.
  And now I want to judge the user whether has authentication to delete the record or not.
  I don't want to control it by <code>ir.model.access</code> or rewrite the unlink method, which can not do something else in advance.</p>
  <p>The system may delete the record or sent a mail to the admin according to the user's level.
  Then I need to get a result from RPC query.</p>
  <pre class="lang-js prettyprint-override"><code>_admin_check: function(){
          var urlParams = new URLSearchParams(url);
          var id = urlParams.get('id');
          var uid = odoo.session_info.uid;
          return rpc.query({
              model: 'res.users',
              method: 'check_administration',
              args: [id,uid],
          }).then(function (result) {
              console.log(result)
              return result // how to actually return result
          });
  
      },
  </code></pre>
  <p>the RPC function which I call.</p>
  <pre class="lang-py prettyprint-override"><code>    def check_administration(self,uid):
          groups = self.env['res.groups']
          bs_manager = []
          lv8 = groups.search([('name', '=', 'level 8')]).users.ids
          lv7 = groups.search([('name', '=', 'level 7')]).users.ids
          admin = groups.search([('name', '=', 'setting')]).users.ids
          bs_manager = [r for r in admin if r not in bs_manager]
          bs_manager += [r for r in lv8 if r not in bs_manager]
          bs_manager += [r for r in lv7 if r not in bs_manager]
          if uid not in bs_manager:
              return False
          else:
              return True
  </code></pre>
  <p>then I call this function (<code>_admin_check</code>) during delete confirmation.</p>
  <pre class="lang-js prettyprint-override"><code>if (this.confirmOnDelete) {
      var is_admin = self._admin_check();
      if(is_admin){
          Dialog.confirm(this, _t(&quot;Are you sure you want to delete this record ?&quot;), {
              confirm_callback: doIt,
          });
      }
      else{
          Dialog.confirm(this, _t(&quot;You are not allow to delete this record. Sysyem will send a request to administrators. &quot;), {
              confirm_callback: self.send_delete_request(),
          });
      }
  } else {
      doIt();
  }
  </code></pre>
  <p>I'm sure the console can get the result is true or false.
  <br/>
  <a href="https://i.stack.imgur.com/GDoIL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDoIL.png" alt="enter image description here" /></a>
  <br/>
  But it seems that can not get by variable <code>is_admin </code>.
  <a href="https://i.stack.imgur.com/KgjLh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KgjLh.png" alt="enter image description here" /></a>
  <br/>
  How can I get it by rpc query?</p>