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 want to override a function called 'user_has_groups' in the class from the file openerp/models.py (line no 1365),
from openerp.models import BaseModel
def my_user_has_groups(self, cr, uid, groups, context=None):
BaseModel.user_has_groups = my_user_has_groups
But it says the following error
TypeError: my_user_has_groups() takes at least 4 arguments (2 given)
and also i tried this line
BaseModel.user_has_groups = lambda cr, uid, groups, context: my_user_has_groups(cr, uid, groups, context)
and now the error is
QWebException: <lambda>() got multiple values for keyword argument 'groups'
How I can achieve this? Please enlighten me.
I solved this in another way around, which is given below
from openerp import models, api
_name = 'basemodel.extend'
def _register_hook(self, cr):
def user_has_groups(self, cr, uid, groups, context=None):
models.BaseModel.user_has_groups = user_has_groups
return super(BaseModelExtend, self)._register_hook(cr)
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: 1/11/16, 10:39 AM|
|Seen: 1239 times|
|Last updated: 1/18/16, 7:26 AM|