SlideShare a Scribd company logo
Building A Website - URLs and Routing
in Odoo 16
● Controllers are used to configure the front end module.
Controllers are created by inheriting the controller.
● Routes are defined through methods decorated with
route()
Let’s check with an example.
We can bring all the sale order details to a webpage.
For that i have created a custom module named tips_and_tricks as follows:
In the directory controllers there are two python files, in “ __init__.py ” i have imported the
main.py and in “ main.py ” i have written a controller as shown below.
The http.Controller was inherited, Inside the route decorator i have specified the page URL as
“ /salesdata ”. Along with URL we can see some other parameters:
• type : It is used to specify the request type. It can be either http or json here i have used http.
• auth : it defines the access to the URL, possible values are user, public & none. here i’m using
public.
• website : It shows the controller either linked to the webpage or not, possible values are True
or False
• Inside the function definition i have searched for all sale order records
with the sales_data variable using search method.
• “ sudo() ” is used to get the super user access and inside the dictionary i
have passed the sales data like this.
• Now we can render the webpage with the sales data as shown in the
image. We are rendering the dictionary values along with the template.
• I have created a directory “ views “ with an xml file named as “ salesdata.xml “
and specified the absolute path in the module manifest file.
• In the sales data.xml i have created the template id as ” tmp_sales_data “ that
have already mentioned while rendering.
• Template consist of a basic odoo website layout and a div created with class
oe_structure and a inner div created with class container.
• A heading is added to the webpage as Sale Order Details.
After that we had created a table with class table-striped with thead and tbody as follows:
Building A Website - URLs and routing
• thead section contains all the table headings
• tbody section we are using foreach for looping the column values.
Here records have the all sale order details and every time order contains an
sale order object.
So that we can access all fields from the sale order by using dot.
Now is the time to test the functionality of the module.
For that install the module and go to website enter the URL ( salesdata )
mentioned in the controller as shown below.
Finally the result is here. We can see the all sale order details in this web page.
The “ __init__.py ” of the module contains the directory controllers were imported and
make the “__manifest__.py” as shown in below:
Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.

More Related Content

PPTX
URLs and Routing in the Odoo 17 Website App
PPTX
URLS and routing in odoo 18 - Odoo Slides
PDF
Introduction to django
PDF
13th Sep, Drupal 7 advanced training by TCS
PPTX
Odoo Building a website _ For the browser
PPTX
How to Build a Module in Odoo 15 Scaffold Method
PPTX
Products and Categories
PDF
Drupal8 for Symfony Developers (PHP Day Verona 2017)
URLs and Routing in the Odoo 17 Website App
URLS and routing in odoo 18 - Odoo Slides
Introduction to django
13th Sep, Drupal 7 advanced training by TCS
Odoo Building a website _ For the browser
How to Build a Module in Odoo 15 Scaffold Method
Products and Categories
Drupal8 for Symfony Developers (PHP Day Verona 2017)

Similar to Building A Website - URLs and routing (20)

PPTX
How to Create a Progress Bar in Odoo 17 - Odoo 17 Slides
PDF
Get things done with Yii - quickly build webapplications
PPTX
How to add menu in Odoo 17 Website - Odoo 17 Slides
PPTX
Onchange
PPTX
Report Actions In Odoo 17 - Odoo 17 Slides
ODP
Rails training presentation routing
PPTX
Odoo 15 Composition of Module
PPTX
E-Bazaar
PPTX
How to Add Pagination in Website portal in Odoo
PDF
Magento SEO Hub Extension
PPTX
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
PPTX
Qweb Templates and Operations in Odoo 18
PPTX
How to Store Data on the Odoo 17 Website
PDF
Build website in_django
PDF
Web development django.pdf
ODP
Routing
PDF
A Comprehensive Guide to Building Custom Odoo Dashboards
PPTX
01 startoff angularjs
PDF
Google Analytics Basic Essentials
How to Create a Progress Bar in Odoo 17 - Odoo 17 Slides
Get things done with Yii - quickly build webapplications
How to add menu in Odoo 17 Website - Odoo 17 Slides
Onchange
Report Actions In Odoo 17 - Odoo 17 Slides
Rails training presentation routing
Odoo 15 Composition of Module
E-Bazaar
How to Add Pagination in Website portal in Odoo
Magento SEO Hub Extension
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
Qweb Templates and Operations in Odoo 18
How to Store Data on the Odoo 17 Website
Build website in_django
Web development django.pdf
Routing
A Comprehensive Guide to Building Custom Odoo Dashboards
01 startoff angularjs
Google Analytics Basic Essentials

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
master seminar digital applications in india
PDF
RMMM.pdf make it easy to upload and study
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
01-Introduction-to-Information-Management.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Basic Mud Logging Guide for educational purpose
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Institutional Correction lecture only . . .
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Pre independence Education in Inndia.pdf
Final Presentation General Medicine 03-08-2024.pptx
Insiders guide to clinical Medicine.pdf
Classroom Observation Tools for Teachers
Module 4: Burden of Disease Tutorial Slides S2 2025
O5-L3 Freight Transport Ops (International) V1.pdf
PPH.pptx obstetrics and gynecology in nursing
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
master seminar digital applications in india
RMMM.pdf make it easy to upload and study
STATICS OF THE RIGID BODIES Hibbelers.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
01-Introduction-to-Information-Management.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Basic Mud Logging Guide for educational purpose
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Institutional Correction lecture only . . .
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pre independence Education in Inndia.pdf

Building A Website - URLs and routing

  • 1. Building A Website - URLs and Routing in Odoo 16
  • 2. ● Controllers are used to configure the front end module. Controllers are created by inheriting the controller. ● Routes are defined through methods decorated with route() Let’s check with an example. We can bring all the sale order details to a webpage.
  • 3. For that i have created a custom module named tips_and_tricks as follows:
  • 4. In the directory controllers there are two python files, in “ __init__.py ” i have imported the main.py and in “ main.py ” i have written a controller as shown below.
  • 5. The http.Controller was inherited, Inside the route decorator i have specified the page URL as “ /salesdata ”. Along with URL we can see some other parameters: • type : It is used to specify the request type. It can be either http or json here i have used http. • auth : it defines the access to the URL, possible values are user, public & none. here i’m using public. • website : It shows the controller either linked to the webpage or not, possible values are True or False
  • 6. • Inside the function definition i have searched for all sale order records with the sales_data variable using search method. • “ sudo() ” is used to get the super user access and inside the dictionary i have passed the sales data like this. • Now we can render the webpage with the sales data as shown in the image. We are rendering the dictionary values along with the template.
  • 7. • I have created a directory “ views “ with an xml file named as “ salesdata.xml “ and specified the absolute path in the module manifest file. • In the sales data.xml i have created the template id as ” tmp_sales_data “ that have already mentioned while rendering. • Template consist of a basic odoo website layout and a div created with class oe_structure and a inner div created with class container. • A heading is added to the webpage as Sale Order Details.
  • 8. After that we had created a table with class table-striped with thead and tbody as follows:
  • 10. • thead section contains all the table headings • tbody section we are using foreach for looping the column values. Here records have the all sale order details and every time order contains an sale order object. So that we can access all fields from the sale order by using dot.
  • 11. Now is the time to test the functionality of the module. For that install the module and go to website enter the URL ( salesdata ) mentioned in the controller as shown below.
  • 12. Finally the result is here. We can see the all sale order details in this web page.
  • 13. The “ __init__.py ” of the module contains the directory controllers were imported and make the “__manifest__.py” as shown in below:
  • 14. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo.