I came across the word "osv" in almost all the OpenERP modules. What does it stand for? Has it something to do with the OpenERP Object Relational Mapper?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
Hi Mr. Mittal
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 name
etc so we must inherit in our openerp model (class)
Thanks
sandeep
As I tried to find out I came along one site:
http://members.hellug.gr/xrg/openerp-doc/html/api_reference/osv/osv.html
There they say: osv = "Objects Services"
It just points to the orm classes.
source: osv.py in server/openerp/osv/osv.py
from openerp.osv.orm import MetaModel, Model, TransientModel, AbstractModel
...
# deprecated - for backward compatibility.
osv = Model
osv_memory = TransientModel
osv_abstract = AbstractModel # ;-)
So you could also use orm.Model to create addons. It's the same. ;)
OSV = Object Service
Keeps the definitions of objects and their fields in memory, more or less.
i saw class previously is osv.osv , now is osv.Model , so the later version for new class should begin with osv.Model ?
That does work, and seems to be the direction they're pushing, but be careful about inheritance in 7.0 at least. I've noticed issues when trying to inherit, for example, an osv.osv_memory class with an osv.TransientModel class. As long as you're consistent you should be fine.
That answers it well. Yes, I also see osv.Model used sometimes where I thought osv.osv should be used. Where can I get a list of all the classes and functions available under "osv" along with what they could be used for. (Reading the osv code for that is one option I have, but I would prefer if I could get some straight docs.)
As of just this morning, OpenERP has rolled out an update to their trunk documentation, available here: https://doc.openerp.com/trunk. The page specifically covering object and field functions is here: https://doc.openerp.com/trunk/server/03_module_dev_02
Most OSV functions are actually in orm.py. osv.py is pretty slim and just wraps the execution of actions so that if an error is raised in the middle of an action, the database can be rolled back to it's state prior, avoiding partial records from being written to the database.
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
mar 15
|
10047 | ||
|
1
mar 15
|
5661 | ||
|
1
oct 19
|
3926 | ||
Execute query when installing addon
Resuelto
|
|
2
may 18
|
9294 | |
|
0
ago 15
|
3981 |
Hi, I casually meet myself with the following issue. odoo.service - Odoo Open Source ERP and CRM
Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-01-08 00:20:52 CET; 13min ago
Process: 2458496 ExecStart=/usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log (code=exited, status=1/FAIL>
Main PID: 2458496 (code=exited, status=1/FAILURE)
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: from .osv.query import Query
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: File "/usr/lib/python3/dist-packages/odoo/osv/__init__.py", line 4, in <module>
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: from . import osv
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: File "/usr/lib/python3/dist-packages/odoo/osv/osv.py", line 5, in <module>
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: from .orm import Model, TransientModel, AbstractModel
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: File "/usr/lib/python3/dist-packages/odoo/osv/orm.py", line 8, in <module>
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: from ..models import (
Jan 08 00:20:52 Bicicletasdelasabana2 odoo[2458496]: ImportError: cannot import name 'MetaModel' from partially initialized module 'odoo.mode>
Jan 08 00:20:52 Bicicletasdelasabana2 systemd[1]: odoo.service: Main process exited, code=exited, status=1/FAILURE
Jan 08 00:20:52 Bicicletasdelasabana2 systemd[1]: odoo.service: Failed with result 'exit-code'.