title: Magento manually change order status to 'complete'
body: <p>I am trying to manually change order status to complete at a certain point in my code. This is what I have so far:</p>
  
  <pre><code>$order = Mage::getModel('sales/order')-&gt;load($_GET['orderid']);
  $order-&gt;setState(Mage_Sales_Model_Order::STATE_COMPLETE, true, 'Pedido completado exitosamente.', true, false)-&gt;save();
  </code></pre>
  
  <p>When I do that I get the error:</p>
  
  <pre><code>The Order state 'complete' must not be set manually.
  </code></pre>
  
  <p>Ok so I tried this:</p>
  
  <pre><code>$order = Mage::getModel('sales/order')-&gt;load($_GET['orderid']);
  $order-&gt;setStatus("complete");
  $order-&gt;save();
  </code></pre>
  
  <p>When I do that I get the error:</p>
  
  <pre><code>Call to a member function getMethodInstance() on a non-object
  </code></pre>
  
  <p>So how can I manually set the order status to complete.</p>
  
  <p>I tried with the first one commenting out the following lines in <code>Sales/Order.php</code>:</p>
  
  <pre><code>if ($shouldProtectState) {
              if ($this-&gt;isStateProtected($state)) {
                  Mage::throwException(
                      Mage::helper('sales')-&gt;__('The Order State "%s" must not be set manually.', $state)
                  );
              }
          }
  </code></pre>
  
  <p>But no go, I still get the not setting to complete error above.</p>
  
  <p>I am using Magento 1.7.0.2.</p>