Search code examples
odooodoo-8odoo-9openerp-8odoo-10

How self in odoo represent more than one class instance using normal traditional python class definition and iterate over them using for i in self


I was confused when I wrote my question, I felt that it was a vague question for some readers. So I rewrote the question again to be clear ?

I learned object oriented programming using Java. My knowledge about self in python that it's like this in Java the two are representing the instance - one instance - of the class itself. Ex: self.name, self.age, etc ...

So the question here, how Odoo framework developers made the self represents more than one instance of the class and iterate over self using traditional normal python class definition ?

for i in self

The answer is can't be achieved using normal python definition they do it using meta-class as described in URLs in the answer of this questions.


Solution

  • Sorry to be late for posting my answer, I found my missing

    Iterate over class instances (self) 01
    Iterate over class instances (self) 02
    Iterate over class instances (self) 03