Search Here

Inherit web login controller in Odoo

 In this article you will learn how to inherit /web/login/ controller in odoo. The purpose of inheriting is you want to add or modify some functionality in existing odoo controller.

Inherit web login controller in odoo

Inherit web login controller in odoo

To inherit controllers in odoo follow below steps:

Import original controller class for example if we want to inherit web/login controller than import 
from openerp.addons.web.controllers.main import Home

Create a new class with any name and inherit that class with original class name
class Extension_Home(Home):

In controller rout just pass empty rout for example 
@http.route()

Create or override existing controller method with same name as original controller has
def web_login(self, redirect=None, **kw):

Return super method that call original controller method
return super(Extension_Home, self).web_login()

inherit_odoo_controller.py


Post a Comment

0 Comments