title: Odoo - Cannot loop through model records
body: <p>I want to call a method every time my module gets installed or updated. Inside that method I want to loop through model records, but I'm only getting different errors.</p>
  
  <p>This documentation looks pretty straightforward: <a href="https://www.odoo.com/documentation/9.0/reference/orm.html" rel="nofollow noreferrer">https://www.odoo.com/documentation/9.0/reference/orm.html</a></p>
  
  <p>But it doesn't work for me. I'm getting this error:</p>
  
  <blockquote>
    <p>ParseError: "'account.tax' object has no attribute '_ids'" while parsing</p>
  </blockquote>
  
  <p>This is how I call the method:</p>
  
  <pre><code>&lt;openerp&gt;
      &lt;data&gt;
          &lt;function model="account.tax" name="_my_method" /&gt;
      &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>I took this from the first answer here: <a href="https://www.odoo.com/forum/help-1/question/how-can-i-execute-a-sql-statement-on-module-update-and-installation-6131" rel="nofollow noreferrer">https://www.odoo.com/forum/help-1/question/how-can-i-execute-a-sql-statement-on-module-update-and-installation-6131</a></p>
  
  <p>My model:</p>
  
  <pre><code>class my_account_tax(models.Model):
      _name = 'account.tax'
      _inherit = 'account.tax'
  
      def _my_method(self, cr, uid, ids=None, context=None):
          self.do_operation()
  
      def do_operation(self):
          print self
          for record in self:
              print record
  </code></pre>
  
  <p>It is basically a copy-paste from the docs. I only added method parameters cr, uid,.. If I take them away (and just leave 'self'), the error is a little different:</p>
  
  <blockquote>
    <p>ParseError: "_my_method() takes exactly 1 argument (3 given)"</p>
  </blockquote>
  
  <p>But also does not tell much.</p>