ORM (Object-relational Mapping) in Odoo
Object relation mapping is a technique that lets you query and manipulates data from a database using an object-oriented paradigm. When talking about ORM, most people are referring to a library that implements the Object-Relational Mapping technique, hence the phrase "an ORM". In simple terms, it is also defined as in Odoo a concept or technique which acts as a bridge between your programming language and your database. The Object Relational Mapping helps to execute SQL queries without writing them explicitly. Once the ORM is configured in an application, the user can use the OOP concepts like classes and objects to interact with the database. As the database in Odoo is in Postgresql so instead of writing query each time you can define one time.
For example, here is a completely imaginary case with a pseudo-language:
You have a student class, you want to retrieve all the student of which the branch is "Computer". Manually, you would do something like that:
student_list = new List();
sql = "SELECT student FROM class WHERE branch = 'Computer'";
data = query(sql); // I over simplify ...
while (row = data.next())
{
student = new Student();
student.setBranch(row.get('branch');
student_list.add(student);
}
With an ORM in odoo, it would look like this:
student_list = StudentTable.query(branch="Computer")