- Model Class
- Record Objects
- Inserting Data
- Getting Data
- Updating Data
- Deleting Data
Odoo has its own ORM packaged into the project. For anyone who is not familiar with the ancronym ORM or object relational mapper, it's basically a way for programmers to work with a database through the code.
This article is going to show you basics of using the Odoo ORM.
What's an ORM?
To provide a little bit of context, before the idea of ORM's came into popularity programmers often needed to understand much more about the databases that they worked with. If they worked with a SQL based database, they needed to know everything about querying data properly, structuring tables and columns, properly handling concurency, cursors, transaction, rollbacks, etc. It's a lot of information just for an application developer to know to build something basic.
ORM's abstract that information away. Instead of creating a table, you may create a model class. Instead of running a select query, you may just run a function. Instead of running an insert query, you may just modify an object.
Essentially it let's programmers be programmers and let's database administrators be database administrators.
For the examples and testing in this article, I'm going to use the Odoo Shell. I would recommend checking out this article if you don't have experience with it.
Objects vs Id's (Equality)
Thanks For Reading
I appreciate you taking the time to read any of my articles. If you're looking for more ramblings, take a look at theentire catalog of articles I've written. Or feel free to give me a follow on Twitter, Instagram, or Github to see what else I've got going on. Or see my contact info below if you want to get in touch with me.