Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Controllers in Odoo

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.11k
    Comment on it

    Controllers need to provide extensibility, much like Model, but can't use the same mechanism as the pre-requisites and database with loaded modules.
    Controllers are provide their own extension mechanism, separate from that of models:
    Controllers are created by inheriting from

    class openerp.http.Controller

    and defining methods decorated with route(): For example code is below.

    class MyController(openerp.http.Controller):
        @route('/some_url', auth='public')
        def handler(self):
            return stuff()
    And override a controller, inherit from its class and override relevant methods,
    class Extension(MyController):
        @route()
        def handler(self):
            do_before()
            return super(Extension, self).handler()

    Note- Controllers thus provide their own extension mechanism, separate from that of models.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: