Odoo Help

Welcome!

This community 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.

0

How to override method of BaseModel (openerp/models.py) in odoo v9 ? [Closed]

By
manuthalasseril
on 1/11/16, 10:24 AM 159 views

The Question has been closed

by
Ermin Trevisan
on 01/11/2016 11:41:05

I want to override a function called 'user_has_groups'  in the class from the file openerp/models.py  (line no 1365),

I tried the code from \this\ post\\
\\\\

\\

from\\ openerp\\.models\\ import\\ BaseModel\\\\

\\\\

def\\ my\\_user\\_has\\_groups\\(self\\,\\ cr\\,\\ uid\\,\\ groups\\,\\ context\\=None\\)\\:\\\\

\\&amp\;nbsp\\;\\&amp\;nbsp\\;\\&amp\;nbsp\\;\\&amp\;nbsp\\;\\&amp\;nbsp\\;\\#my\\ code\\\\

\\ \\ \\ \\ \\\\

BaseModel\\.user\\_has\\_groups\\ \\=\\ my\\_user\\_has\\_groups\\\\\

But\\ it\\ says\\ the\\ error\\&amp\;nbsp\\;\\\\

\\\\

\\

TypeError\\:\\ my\\_user\\_has\\_groups\\(\\)\\ takes\\ at\\ least\\ 4\\ arguments\\ \\(2\\ given\\)\\How\\ I\\ can\\ achieve\\ this\\?\\ Please\\ help\\ me\\
\\
NB\\:\\ I\\ also\\ tried\\ the\\ code\\ from\\&amp\;nbsp\\;\\this post. But it doesn't works

Double post.

Ermin Trevisan
on 1/11/16, 11:42 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/11/16, 10:24 AM
Seen: 159 times
Last updated: 1/11/16, 11:41 AM