title: Call a server action from another server action in Odoo
body: <p>I'm trying to call a server action from another server action in Odoo 10. According to the <a href="https://www.odoo.com/documentation/10.0/reference/actions.html#code" rel="nofollow noreferrer">documentation</a> you can assign an <code>action</code> variable within the code of the first action in order to call the next action. This doesn't seem to be working for me.</p>
  
  <p>My first action is defined on the <code>stock.quant</code> model with the following code:</p>
  
  <pre><code>if record:
      log('main')
      action = {
          "type": "ir.actions.server",
          "id": 366,
          "model_id": record.product_id.id,
      }
  </code></pre>
  
  <p>Then, I have another server action defined, which has database id <code>366</code>. It's defined on the <code>product.product</code> model with the following code:</p>
  
  <pre><code>log('triggered')
  </code></pre>
  
  <p>When I trigger the first action, I would expect to see a log entry for <code>main</code> and an entry for <code>triggered</code>. However, I only see an entry for <code>main</code>, indication that the second action never gets triggered.</p>
  
  <p>Am I doing something wrong? What is the appropriate way to trigger one server action from another server action?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Through trial and error I made some progress and was able to get the second server action to trigger. The way to trigger it and pass in the appropriate model for the second action to run with is:</p>
  
  <pre><code>action = {
      "type": "ir.actions.server",
      "id": 366,
      "context": {"active_id": record.product_id.id, "active_model": "product.product"}
  }
  </code></pre>
  
  <p>Everything works fine when I add the first action to the model's "More" menu, and trigger it manually through the UI. I see both "main" and "trigger" logged.</p>
  
  <p>However, when I use an Automated Action to trigger this action on Update or Create of a <code>stock.quant</code> model, only the first action is getting triggered. In other words, only "main" is logged, but "trigger" is not. Why would the second action successfully trigger when manually triggering the first action but not work when the first action is triggered via an automated action?</p>