Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

add my own method in inherited controller odoo 12

Odoberať

Get notified when there's activity on this post

This question has been flagged
controllerswebsiteodoo12
3 Replies
3477 Zobrazenia
Avatar
Oeil d'Horis

How to inherit controller and add my own method

0
Avatar
Zrušiť
Sehrish

try this:
1- https://learnopenerp.blogspot.com/2020/08/inherit-web-login-controller-in-odoo.html
2- https://learnopenerp.blogspot.com/2021/09/inherit-login-and-logout-web-controller.html
3- https://learnopenerp.blogspot.com/2018/08/odoo-web-controller.html

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Try refer the blog below which helps you to write your own code in an existing controller method.

https://www.cybrosys.com/blog/web-controllers-in-odoo

Regards

1
Avatar
Zrušiť
Oeil d'Horis
Autor

i did this and now it's working if u check my code..
but it create my record on the backend however after the POST action return the link defined with "undifined" and no redirection

Avatar
Oeil d'Horis
Autor Best Answer
class CustomWebsiteHrRecruitment(WebsiteHrRecruitment):
    @http.route(['/jobs',
                '/jobs/country/',
                '/jobs/department/',
                '/jobs/country//department/',
                '/jobs/office/',
                '/jobs/country//office/',
                '/jobs/department//office/',
                '/jobs/country//department//office/',
            ], type='http', auth="public", website=True)
    def jobs(self, country=None, department=None, office_id=None, **kwargs):
        res = super(CustomWebsiteHrRecruitment, self).jobs(country=None,
                                                           department=None,
                                                           office_id=None,
                                                           **kwargs)
        dpts = request.env['hr.department'].sudo().search([])
        vals = {'dpts' : dpts,}
        res.qcontext.update(vals)
        _logger.info("=====>::: %s :::<======"%(res.qcontext))
        return res
    @http.route('/create/spontaneous_application/', type="http", auth="public", website=True)
    def create_spontaneous_application(self,self_id, **kw):
        vals = {'name' : 'Spontaneous Application\'s %s'%(kw.get('partner_name')),
                'department_id' : kw.get('dpt'),
                'description' : kw.get('description')}
        spontaneous_application = request.env['hr.job'].create(vals)
        _logger.info("======>Spontaneous Application : %s  created<========"%(spontaneous_application.name))
        return http.request.render('/', {})
0
Avatar
Zrušiť
Oeil d'Horis
Autor

but in the second method in the controller my redirection on the home page doesn't work. can someone help me pls ?

Avatar
Yogesh Sakhreliya
Best Answer

You can redirect instead of render.


Like :- return http.request.redirect("/")

0
Avatar
Zrušiť
Oeil d'Horis
Autor

it's not working too :(

my logs:

2021-10-25 13:58:10,944 1 INFO scin_db odoo.addons.custum.controllers.main: ======>Spontaneous Application : Spontaneous Application's Moustapha Ndiaye created<========

2021-10-25 13:58:10,944 1 INFO scin_db odoo.addons.custum.controllers.main: ======> Application of : Moustapha Ndiaye 's Application created<========

2021-10-25 13:58:10,947 1 INFO scin_db werkzeug: 41.83.44.156 - - [25/Oct/2021 13:58:10] "POST /create/spontaneous_application/undefined HTTP/1.1" 302 - 540 0.230 1.824

Yogesh Sakhreliya

Can you please try with following return statment?

return http.request.redirect('/web')

Oeil d'Horis
Autor

Thank Yogesh Sakhreliya but not working until now.. I think it's about the website_form. i will check the documentation of this module

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
move webpage from one project to another
website odoo12
Avatar
Avatar
Avatar
2
júl 25
7389
Data from website with controller Solved
controllers website
Avatar
Avatar
Avatar
2
júl 24
4973
How to raise 403 Error (Forbiden) and 404 error in Odoo web controller Solved
controllers website
Avatar
Avatar
Avatar
Avatar
3
apr 24
6547
Unpublished website page can't view by Agent without access in website in settings
website odoo12
Avatar
0
sep 22
803
Website Flash Message
controllers website
Avatar
0
sep 21
2710
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now