SlideShare a Scribd company logo
1 of 14
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:
• 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

Similar to Building A Website - URLs and routing

Rails training presentation routing
Rails training presentation   routingRails training presentation   routing
Rails training presentation routingtheacadian
 
Odoo 15 Composition of Module
Odoo 15 Composition of ModuleOdoo 15 Composition of Module
Odoo 15 Composition of ModuleCeline George
 
Magento SEO Hub Extension
Magento SEO Hub ExtensionMagento SEO Hub Extension
Magento SEO Hub ExtensionAppJetty
 
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxMongoDB
 
Build website in_django
Build website in_django Build website in_django
Build website in_django swee meng ng
 
Web development django.pdf
Web development django.pdfWeb development django.pdf
Web development django.pdfKomalSaini178773
 
01 startoff angularjs
01 startoff angularjs01 startoff angularjs
01 startoff angularjsErhwen Kuo
 
Google Analytics Basic Essentials
Google Analytics Basic EssentialsGoogle Analytics Basic Essentials
Google Analytics Basic EssentialseMarket Education
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineYared Ayalew
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios
 
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)MongoDB
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
Building a Module in Odoo 16
Building a Module in Odoo 16Building a Module in Odoo 16
Building a Module in Odoo 16Celine George
 
How to migrate 3dCart to Shopify with Litextension
How to migrate 3dCart to Shopify with LitextensionHow to migrate 3dCart to Shopify with Litextension
How to migrate 3dCart to Shopify with LitextensionLitExtension
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesLeonardo Fernandes
 

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

Onchange
OnchangeOnchange
Onchange
 
Rails training presentation routing
Rails training presentation   routingRails training presentation   routing
Rails training presentation routing
 
Odoo 15 Composition of Module
Odoo 15 Composition of ModuleOdoo 15 Composition of Module
Odoo 15 Composition of Module
 
E-Bazaar
E-BazaarE-Bazaar
E-Bazaar
 
Django by rj
Django by rjDjango by rj
Django by rj
 
Magento SEO Hub Extension
Magento SEO Hub ExtensionMagento SEO Hub Extension
Magento SEO Hub Extension
 
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
 
Build website in_django
Build website in_django Build website in_django
Build website in_django
 
Web development django.pdf
Web development django.pdfWeb development django.pdf
Web development django.pdf
 
Routing
RoutingRouting
Routing
 
01 startoff angularjs
01 startoff angularjs01 startoff angularjs
01 startoff angularjs
 
Google Analytics Basic Essentials
Google Analytics Basic EssentialsGoogle Analytics Basic Essentials
Google Analytics Basic Essentials
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
 
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
Building a Module in Odoo 16
Building a Module in Odoo 16Building a Module in Odoo 16
Building a Module in Odoo 16
 
How to migrate 3dCart to Shopify with Litextension
How to migrate 3dCart to Shopify with LitextensionHow to migrate 3dCart to Shopify with Litextension
How to migrate 3dCart to Shopify with Litextension
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

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:
  • 9.
  • 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.