Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo class differences

Tags:

odoo

openerp

When creating class sometimes use osv.osv, also we use models.Model What is the basic difference between these two? Is there any advantages over another?

like image 997
nikolas Avatar asked Dec 08 '22 03:12

nikolas


2 Answers

Before version 7,

osv is a class and an OpenERP descriptor class and all the class( model) must inherit it for OpenERP module deployment.

osv class inside in OSV module in OpenERP server , which content all the OpenERP properties like you can see _column, _defaults and other many things there such as nameetc so we must inherit in our openerp model (class)

In version 7,

The ORM, short for Object-Relational Mapping, is a central part of OpenERP.

In OpenERP, the data model is described and manipulated through Python classes and objects. It is the ORM job to bridge the gap -- as transparently as possible for the developer -- between Python and the underlying relational database (PostgreSQL), which will provide the persistence we need for our objects.

osv.osv and orm.Model is deprecated and it still works for backward compatibility. You should use models.Model instead.

In version 8+,

The model transition was

osv.osv ---> orm.Model ---> models.Model

osv.TransientModel ---> orm.TransientModel ---> models.TransientModel

like image 79
no coder Avatar answered Dec 28 '22 11:12

no coder


The osv.osv was used in the former API. It is deprecated. it still works but should be avoided.

With the new API models.Model should be used.

like image 40
Daniel Reis Avatar answered Dec 28 '22 10:12

Daniel Reis