This question has been flagged
9 Replies
23970 Views

# -*- coding: utf-8 -*-

# Part of Odoo. See LICENSE file for full copyright and licensing details.


from odoo import http

from odoo.http import request



class OnboardingController(http.Controller):


    @http.route('/sales/sale_quotation_onboarding_panel', auth='user', type='json')

    def sale_quotation_onboarding(self):

        """ Returns the `banner` for the sale onboarding panel.

            It can be empty if the user has closed it or if he doesn't have

            the permission to see it. """


        company = request.env.user.company_id

        if not request.env.user._is_admin() or \

           company.sale_quotation_onboarding_state == 'closed':

            return {}


        return {

            'html': request.env.ref('sale.sale_quotation_onboarding_panel').render({

                'company': company,

                'state': company.get_and_update_sale_quotation_onboarding_state()

            })

        }

i need to inherit  function  sale_quotation_onboarding()

please help

thanks in advance

Avatar
Discard
Best Answer

You need to import the class in your custom module and then override the method.

Try following code:

from odoo import http
from odoo.addons.sale.controllers.onboarding import OnboardingController # Import the class


class CustomOnboardingController(OnboardingController): # Inherit in your custom class

@http.route('/sales/sale_quotation_onboarding_panel', auth='user', type='json')
def sale_quotation_onboarding(self):
res = super(CustomOnboardingController, self).sale_quotation_onboarding()
# Your code goes here
return res


Avatar
Discard
Author

but super is not working

Please check my updated answer.

res = super(CustomOnboardingController, self).sale_quotation_onboarding()

Author

its working thanks for the update

Thanks Sudhir Arya

How could I insert or modify data over 'res = super(.....)'?

You can use "response.qcontext" to get the result returned from super.

Best Answer

Excellent

Avatar
Discard