Skip to Content
Menu
This question has been flagged
3 Replies
1685 Views

Hi,

I installed 'website' module

then in my module "fleet_rental" , created a controller folder with two files, fleet_web.py and _init_.py

In _init_.py, I wrote like this:

import fleet_web

In fleet_web.py, I wrote like this:

from odoo import http


class FleetWeb(http.Controller):

@http.route('/fleet_web/', type='http', auth='public', website=True)
def render_reservation_page(self):
return http.request.render('fleet_rental.reservation_page', {})

Then I created an xml file , views/reservation_webpage.xml where I wrote:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="reservation_page" name="Online Reservation page" page="True">
<t t-call="website.layout">
<div class="oe_structure">
<div class="container">
<center><h3>Title</h3></center>
<p>
You can add all your content here.<br/>
<a t-attf-href="/fleet_web/detail" class="btn btn-info">Online Booking</a>
</p>
</div>
</div>
</t>
</template>
</data>
</odoo>

Then i updated the module and in website if I give http://localhost:8069/fleet_web
I am getting following error:

404: Page not found!

The page you were looking for could not be found; it is possible you have typed the address incorrectly, but it has most probably been removed due to the recent website reorganisation.

Maybe you were looking for one of these popular pages ?



Please help and tell me If I went wrong anywhere or I have to do anything else

Avatar
Discard

check if you have imported your controller folder in __init__.py of the module and defined xml file in manifest file

Author

Yes I did both.

Best Answer

hi, have you found the answer of your problem?
have you tried to restart the odoo service? try differect url, may be the cache is not updated?

try to return some string, without rendering any view. lets see if it works.

add this into your controller:

"render_reservation_page" lets change this to something else, im afraid you have override this somewhere.


@http.route('/fleet_new', type='http', auth='public', website=True)
def lets_use_different_name(self):
return "some string"
Avatar
Discard