Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I wanna change something in export_data function then I wanna override BaseModel class. But really don't know how to override this? I try to copy a file file orm.py and fix import but the it not call in side this file.
First you have to inherit the class
BaseModel and then can override the method.
class Extend_BaseModel(BaseModel): def export_data(self, cr, uid, ids, fields_to_export, context=None): #Your code #You may call super also if you want like this: super(Extend_BaseModel, self).export_data(cr, uid, ids, fields_to_export, context=context) #Your code
Hope this will help you and solve you problem.
Serpent Consulting Services.
I achieve overriding BaseModel methods in V7 :
1- create a new python file my_basemodel.py
2- add your custom methods like this
from openerp.osv.orm import BaseModel
def my_method(self, cr, uid, ids, context=None):
BaseModel.method = my_method # Method is referring to an ORM methode (read, unlink, export_data, ...)
3- save the file and add it to __init__.py
4- Restart your server
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/14/13, 6:23 AM|
|Seen: 1975 times|
|Last updated: 3/16/15, 8:10 AM|