How to inherit the /web/login controller such that the method return should not return control to another module who has been also inherit
I want to inherit the '/web/login' controller but the problem is when my function return, the control goes to the method who has also inherit and then it return their functionality instead of my functionality.
Let me give example what is happening in my case when 'website' module is also installed.
# my custome module code class myClass(Home):
@http.route() def web_login(self, redirect=None, *args, **kw):
response = super(myClass, self).web_login(redirect=redirect, *args, **kw)
return request.render('myModule.myTemplate', data)
# Odoo file located at ../odoo/addons/website/controllers/main.py
@http.route(website=True, auth="public") def web_login(self, redirect=None, *args, **kw): logger.debug('3') response = super(Website, self).web_login(redirect=redirect, *args, **kw) if not redirect and request.params['login_success']: if request.env['res.users'].browse(request.uid).has_group('base.group_user'): redirect = '/web?' + request.httprequest.query_string else: redirect = '/' logger.debug('4') return http.redirect_with_hash(redirect) logger.debug('5') return response
The output is:
So basically instead of rendering myModule.myTemplate template which is after logger label as '2', the control goes to website module and it return http.redirect_with_hash(redirect) which is after logger label as '4'.
How to achieve this so that no matter whoever the method is last but it should always return my code which is myModule.myTemplate.
It will be very helpful which you share example code to solve this issue. If anything which need some more clarification then let me know. I will try to explain more.
PS: My custom module can only depend on web module, so I can't add dependency to website module to overcome the solution. However, we can install website module later, Just saying considering this issue can only solve by understanding this solution: \https://www.odoo.com/forum/help-1/question/v8-general-question-about-method-inheritance-multiple-override-in-different-modules-100032