Search code examples
pythonodooweb-controlsodoo-12

How to inherit controller of a third party module for customization Odoo 12?


I have a module with a controller and I need to inherit it in a newly created module for some customization. I searched about the controller inheritance in Odoo and I found that we can inherit Odoo's base modules' controllers this way:

from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager, get_records_pager

but how can I do this for a third party module's controller? In my case, the third party module directory is one step back from my own module's directory. If I should import the class of a third party module controller, how should I do it?


Solution

  • It is not a problem whether you are using a custom module.If the module installed in the database you can import as from odoo.addons.

    Eg : from odoo.addons.your_module.controllers.main import MyClass