تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
236 أدوات العرض

Hi I have created a website of two pages one page is the home page and other page is form page. Home page i have devloped form the snippets, drag and drop from the website while the other form page i have developed it from the code, template in xml and the controllers. When i access the databse to login like when i opned the login page the login in not appearing its just showing the two pages.
tell me how to resolve it?

الصورة الرمزية
إهمال

What does "its just showing the two pages" mean? What is the source code of that "page i have developed it from the code, template in xml and the controllers"?

الكاتب

  Its showing this page when i try to login to the databse and this page page which is showng is for the public users (which i developed form drag n drop feature on the odoo website) and the other page which sis book now page is hidden for public usrs only for internal users(i devloped that page from the scratch). Now tell what i have to do that to login page for databse could appear?

Again, what is the source code of that page you've developed? /web/login can't just vanish on it's own.

الكاتب
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="book_now_template" name="Book Now">
<t t-if="request.httprequest.path != '/web/login'">
<t t-call="website.layout">
<!-- Background image section with fallback -->
<section class="s_picture o_cc3 o_colored_level pt88 oe_img_bg o_bg_img_center
o_bg_img_origin_border_box pb80"
data-snippet="s_picture" data-name="Title - Image"
style="background-image:url
(&quot;/web/image/882-1fc3d7f6/AdobeStock_315207935-scaled-1%20%281%29.webp&quot;);"
data-mimetype="image/webp" data-original-id="854"
data-original-src="/web/image/854-1fc3d7f6/AdobeStock_315207935-scaled-1%20%281%29.webp"
data-mimetype-before-conversion="image/webp" data-resize-width="1920" data-quality="100">
<div class="o_container_small">
<h2 style="text-align: center;">&amp;nbsp;<br/></h2>
</div>
</section>
<div class="container">
<!-- Logged-in user form -->
<t t-if="request.env.user != request.env.ref('base.public_user')">
<section data-visibility-id="logged_o_1" class="pt-5">
<p class="mb-3 text-center">Contact us about anything related to our company or services</p>
<form id="contactus_form_loggedin" action="/submit/task/logged_in" method="post" enctype="multipart/form-data"
data-mark="*" data-model_name="project.task" data-success-mode="redirect"
data-success-page="/your-task-has-been-submitted" data-pre-fill="true">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="s_website_form_rows row s_col_no_bgcolor">
<!-- Job Address -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="job_address">
<span class="s_website_form_label_content">Job Address</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="text" name="job_address" placeholder="" id="job_address" required="1"/>
</div>
</div>
</div>
<!-- Service Type -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="selection">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="service_type">
<span class="s_website_form_label_content">Service Type</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<select class="form-select s_website_form_input" name="service_type" id="service_type" required="1">
<option value="">Select service type</option>
<option value="plumbing">Plumbing and Heating</option>
<option value="gas">Gas</option>
<option value="drainage">Drainage</option>
<option value="other">Other</option>
</select>
</div>
</div>
</div>
<!-- Job Description -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="job_description">
<span class="s_website_form_label_content">Job Description</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="text" name="job_description" placeholder="" id="job_description" required="1"/>
</div>
</div>
</div>
<!-- Request Callback -->
<div class="form-group s_website_form_field mb-3 col-12 col-lg-12" data-type="boolean" data-name="request_callback">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="request_callback">
<span class="s_website_form_label_content">Request a Callback</span>
</label>
<div class="col-sm">
<div class="form-check">
<input type="checkbox" class="form-check-input s_website_form_input" name="request_callback" id="request_callback" value="True"/>
<label class="form-check-label" for="request_callback">Request a Callback</label>
</div>
<div class="s_website_form_field_description small form-text text-muted">Select to request a callback.</div>
</div>
</div>
</div>
<!-- Preferred Date -->
<div class="form-group s_website_form_field mb-3 col-12" data-type="date" data-name="preferred_date">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="preferred_date">
<span class="s_website_form_label_content">Preferred Date</span>
</label>
<div class="col-sm">
<input type="date" class="form-control s_website_form_input o_website_form_date" name="preferred_date" id="preferred_date" placeholder="YYYY-MM-DD"/>
<div class="s_website_form_field_description small form-text text-muted">Select your preferred date for the service.</div>
</div>
</div>
</div>
<!-- Preferred Time Slot -->
<div class="form-group s_website_form_field mb-3 col-12 col-lg-12" data-type="selection" data-name="time_slot">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="time_slot">
<span class="s_website_form_label_content">Preferred Time Slot</span>
</label>
<div class="col-sm">
<select class="form-select s_website_form_input" name="time_slot" id="time_slot">
<option value="">Select a time slot</option>
<option value="morning">Morning (8am-12pm)</option>
<option value="afternoon">Afternoon (1pm-5pm)</option>
<option value="allday">All day (anytime)</option>
</select>
<div class="s_website_form_field_description small form-text text-muted">Choose your preferred time slot for the service.</div>
</div>
</div>
</div>
<!-- Attach Picture -->
<div class="s_website_form_field mb-3 col-12 col-lg-12 s_website_form_custom" data-type="binary">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-sm-auto s_website_form_label" style="width: 200px" for="attachment_ids">
<span class="s_website_form_label_content">Attach Picture</span>
</label>
<div class="col-sm">
<input type="file" class="form-control s_website_form_input" name="attachment_ids" multiple="" id="attachment_ids" data-max-files-number="5" data-max-file-size="1"/>
<div class="s_website_form_field_description small form-text text-muted">Attach pictures of the job to assist us in resolving your request.</div>
</div>
</div>
</div>
<!-- Project ID -->
<div class="s_website_form_field mb-3 col-12 s_website_form_dnone">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px">
<span class="s_website_form_label_content"/>
</label>
<div class="col-sm">
<input type="hidden" name="project_id" t-att-value="request.env['project.project'].sudo().search([('name', '=', 'Nova Plumbing')], limit=1).id or 0"/>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="mb-0 py-2 col-12 s_website_form_submit s_website_form_no_submit_label text-center col-lg-12 pb24" data-name="Submit Button">
<div style="width: 200px;" class="s_website_form_label"/>
<button type="submit" class="s_website_form_send btn btn-primary btn-lg">Submit</button>
<span id="s_website_form_result" class="me-2 small text-danger"/>
</div>
</div>
</form>
</section>
</t>
<!-- Logged-out user form -->
<t t-else="">
<section data-visibility-id="logged_out_1" class="pt-5">
<p class="mb-3 text-center">If you are already a user,
then you have to login and then submit the form.</p>
<div class="text-center mb-3">
<a href="/web/login" class="btn btn-primary btn-lg">Login</a>
</div>
<form id="contactus_form_logged_out" action="/submit/task/logged_out" method="post" enctype="multipart/form-data"
data-mark="*" data-model_name="project.task" data-success-mode="redirect"
data-success-page="/your-task-has-been-submitted">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="s_website_form_rows row s_col_no_bgcolor">
<!-- Name -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="name">
<span class="s_website_form_label_content">Name</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="text" name="name" placeholder="" id="name" required="1"/>
</div>
</div>
</div>
<!-- Email -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="email">
<span class="s_website_form_label_content">Email</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="email" name="email" placeholder="" id="email" required="1"/>
</div>
</div>
</div>
<!-- Phone -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="phone">
<span class="s_website_form_label_content">Phone</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="tel" name="phone" placeholder="" id="phone"/>
</div>
</div>
</div>
<!-- Job Address -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="job_address">
<span class="s_website_form_label_content">Job Address</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="text" name="job_address" placeholder="" id="job_address" required="1"/>
</div>
</div>
</div>
<!-- Service Type -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="selection">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="service_type">
<span class="s_website_form_label_content">Service Type</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<select class="form-select s_website_form_input" name="service_type" id="service_type" required="1">
<option value="">Select service type</option>
<option value="plumbing">Plumbing and Heating</option>
<option value="gas">Gas</option>
<option value="drainage">Drainage</option>
<option value="other">Other</option>
</select>
<div class="s_website_form_field_description small form-text text-muted">Select the service type you want</div>
</div>
</div>
</div>
<!-- Job Description -->
<div class="s_website_form_field mb-3 col-12 s_website_form_custom" data-type="char">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="job_description">
<span class="s_website_form_label_content">Job Description</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input class="form-control s_website_form_input" type="text" name="job_description" placeholder="" id="job_description" required="1"/>
</div>
</div>
</div>
<!-- Request Callback -->
<div class="form-group s_website_form_field mb-3 col-12 col-lg-12" data-type="boolean" data-name="request_callback">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="request_callback">
<span class="s_website_form_label_content">Request a Callback</span>
</label>
<div class="col-sm">
<div class="form-check">
<input type="checkbox" class="form-check-input s_website_form_input" name="request_callback" id="request_callback" value="True"/>
<label class="form-check-label" for="request_callback">Request a Callback</label>
</div>
<div class="s_website_form_field_description small form-text text-muted">Select to request a callback.</div>
</div>
</div>
</div>
<!-- Preferred Date -->
<div class="form-group s_website_form_field mb-3 col-12" data-type="date" data-name="preferred_date">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="preferred_date">
<span class="s_website_form_label_content">Preferred Date</span>
</label>
<div class="col-sm">
<input type="date" class="form-control s_website_form_input o_website_form_date" name="preferred_date" id="preferred_date" placeholder="YYYY-MM-DD"/>
<div class="s_website_form_field_description small form-text text-muted">Select your preferred date for the service.</div>
</div>
</div>
</div>
<!-- Preferred Time Slot -->
<div class="form-group s_website_form_field mb-3 col-12 col-lg-12" data-type="selection" data-name="time_slot">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="time_slot">
<span class="s_website_form_label_content">Preferred Time Slot</span>
</label>
<div class="col-sm">
<select class="form-select s_website_form_input" name="time_slot" id="time_slot">
<option value="">Select a time slot</option>
<option value="morning">Morning (8am-12pm)</option>
<option value="afternoon">Afternoon (1pm-5pm)</option>
<option value="allday">All day (anytime)</option>
</select>
<div class="s_website_form_field_description small form-text text-muted">Choose your preferred time slot for the service.</div>
</div>
</div>
</div>
<!-- Attach Picture -->
<div class="s_website_form_field mb-3 col-12 col-lg-12 s_website_form_custom" data-type="binary">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-sm-auto s_website_form_label" style="width: 200px" for="attachment_ids">
<span class="s_website_form_label_content">Attach Picture</span>
</label>
<div class="col-sm">
<input type="file" class="form-control s_website_form_input" name="attachment_ids" multiple="" id="attachment_ids" data-max-files-number="5" data-max-file-size="1"/>
<div class="s_website_form_field_description small form-text text-muted">Attach pictures of the job to assist us in resolving your request.</div>
</div>
</div>
</div>
<!-- Project ID -->
<div class="s_website_form_field mb-3 col-12 s_website_form_dnone">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px">
<span class="s_website_form_label_content"/>
</label>
<div class="col-sm">
<input type="hidden" name="project_id" t-att-value="request.env['project.project'].sudo().search([('name', '=', 'Nova Plumbing')], limit=1).id or 0"/>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="mb-0 py-2 col-12 s_website_form_submit s_website_form_no_submit_label text-center col-lg-12 pb24" data-name="Submit Button">
<div style="width: 200px;" class="s_website_form_label"/>
<button type="submit" class="s_website_form_send btn btn-primary btn-lg">Submit</button>
<span id="s_website_form_result" class="me-2 small text-danger"/>
</div>
</div>
</form>
</section>
</t>
</div>
</t>
</t>
</template>

<!-- Menu of the Page-->
<record id="custom_contact_us_page" model="website.page">
<field name="name">Book Now</field>
<field name="url">/book-now</field>
<field name="view_id" ref="task_extension.book_now_template"/>
<field name="website_published">1</field>
</record>
</data>
</odoo>


_logger = logging.getLogger(__name__)

class WebsiteFormController(http.Controller):

@http.route(['/submit/task/logged_in'], type='http', auth="user", website=True)
def submit_task_logged_in(self, **kwargs):
_logger.info("📨 Logged-in user: %s, Form data: %s", request.env.user.name, kwargs)
_logger.info("Received request_callback: %s", kwargs.get('request_callback', 'Not provided'))
_logger.info("Received preferred_date: %s", kwargs.get('preferred_date', 'Not provided'))
_logger.info("Received time_slot: %s", kwargs.get('time_slot', 'Not provided'))

# Check user
if not request.env.user or request.env.user == request.env.ref('base.public_user'):
_logger.error("User not logged in")
return request.redirect('/web/login?redirect=/book-now')

# Check partner
partner = request.env.user.partner_id
if not partner:
_logger.error("No partner found for user: %s", request.env.user.name)
return request.redirect('/book-now')

# Validate project_id
default_project = request.env['project.project'].sudo().search([('name', '=', 'Nova Plumbing')], limit=1)
if not default_project:
_logger.error("No 'Nova Plumbing' project found")
return request.redirect('/book-now')
project_id = default_project.id

# Validate required fields
required_fields = ['job_address', 'service_type', 'job_description']
missing_fields = [f for f in required_fields if not kwargs.get(f)]
if missing_fields:
_logger.error("Missing required fields: %s", missing_fields)
return request.redirect('/book-now')

# Parse preferred date
preferred_date = False
if kwargs.get('preferred_date'):
try:
preferred_date = datetime.strptime(kwargs.get('preferred_date'), '%Y-%m-%d').date()
_logger.info("Processed preferred_date: %s", preferred_date)
except ValueError:
_logger.warning("⚠️ Invalid date format: %s", kwargs.get('preferred_date'))

# Handle time_slot
time_slot = kwargs.get('time_slot', False)
valid_time_slots = ['morning', 'afternoon', 'allday', '']
if time_slot not in valid_time_slots:
_logger.warning("Invalid time_slot: %s", time_slot)
time_slot = False
_logger.info("Processed time_slot: %s", time_slot)

# Prepare task values
task_vals = {
'partner_id': partner.id,
'customer_email': partner.email or '',
'customer_phone': partner.phone or '',
'job_address': kwargs.get('job_address', False),
'service_type': kwargs.get('service_type', False).lower() if kwargs.get('service_type') else False,
'job_description': kwargs.get('job_description', False),
'request_callback': kwargs.get('request_callback') == 'True',
'preferred_date': preferred_date,
'time_slot': time_slot,
'project_id': project_id,
}
_logger.info("Prepared task values: %s", task_vals)

# Create task
try:
task = request.env['project.task'].sudo().create(task_vals)
_logger.info("Task created: ID=%s, time_slot=%s", task.id, task.time_slot)
except Exception as e:
_logger.error("Error creating task: %s", str(e))
return request.redirect('/book-now')

# Handle file attachments
files = request.httprequest.files.getlist('attachment_ids')
for f in files:
if f and f.filename:
try:
attachment = request.env['ir.attachment'].sudo().create({
'name': f.filename,
'type': 'binary',
'datas': base64.b64encode(f.read()),
'res_model': 'project.task',
'res_id': task.id,
})
task.attachment_ids = [(4, attachment.id)]
except Exception as e:
_logger.warning("Error attaching file %s: %s", f.filename, str(e))

return request.redirect('/your-task-has-been-submitted')

@http.route(['/submit/task/logged_out'], type='http', auth="public", website=True)
def submit_task_logged_out(self, **kwargs):
_logger.info("📨 Non-logged-in user form submission: %s", kwargs)
_logger.info("Received request_callback: %s", kwargs.get('request_callback', 'Not provided'))
_logger.info("Received preferred_date: %s", kwargs.get('preferred_date', 'Not provided'))
_logger.info("Received time_slot: %s", kwargs.get('time_slot', 'Not provided'))

# Validate required fields
required_fields = ['name', 'email', 'job_address', 'service_type', 'job_description']
missing_fields = [f for f in required_fields if not kwargs.get(f)]
if missing_fields:
_logger.error("Missing required fields: %s", missing_fields)
return request.redirect('/book-now')

# Check partner
partner = request.env['res.partner'].sudo().search([('email', '=', kwargs.get('email'))], limit=1)
if not partner:
try:
partner = request.env['res.partner'].sudo().create({
'name': kwargs.get('name'),
'email': kwargs.get('email'),
'phone': kwargs.get('phone'),
'is_company': False,
})
_logger.info("Created partner: ID=%s, Name=%s", partner.id, partner.name)
except Exception as e:
_logger.error("Error creating partner: %s", str(e))
return request.redirect('/book-now')

# Validate project_id
default_project = request.env['project.project'].sudo().search([('name', '=', 'Nova Plumbing')], limit=1)
if not default_project:
_logger.error("No 'Nova Plumbing' project found")
return request.redirect('/book-now')
project_id = default_project.id

# Parse preferred date
preferred_date = False
if kwargs.get('preferred_date'):
try:
preferred_date = datetime.strptime(kwargs.get('preferred_date'), '%Y-%m-%d').date()
_logger.info("Processed preferred_date: %s", preferred_date)
except ValueError:
_logger.warning("⚠️ Invalid date format: %s", kwargs.get('preferred_date'))

# Handle time_slot
time_slot = kwargs.get('time_slot', False)
valid_time_slots = ['morning', 'afternoon', 'allday', '']
if time_slot not in valid_time_slots:
_logger.warning("Invalid time_slot: %s", time_slot)
time_slot = False
_logger.info("Processed time_slot: %s", time_slot)

# Prepare task values
task_vals = {
'partner_id': partner.id,
'customer_email': kwargs.get('email'),
'customer_phone': kwargs.get('phone'),
'job_address': kwargs.get('job_address', False),
'service_type': kwargs.get('service_type', False).lower() if kwargs.get('service_type') else False,
'job_description': kwargs.get('job_description', False),
'request_callback': kwargs.get('request_callback') == 'True',
'preferred_date': preferred_date,
'time_slot': time_slot,
'project_id': project_id,
}
_logger.info("Prepared task values: %s", task_vals)

# Create task
try:
task = request.env['project.task'].sudo().create(task_vals)
_logger.info("Task created: ID=%s, time_slot=%s", task.id, task.time_slot)
except Exception as e:
_logger.error("Error creating task: %s", str(e))
return request.redirect('/book-now')

# Handle file attachments
files = request.httprequest.files.getlist('attachment_ids')
for f in files:
if f and f.filename:
try:
attachment = request.env['ir.attachment'].sudo().create({
'name': f.filename,
'type': 'binary',
'datas': base64.b64encode(f.read()),
'res_model': 'project.task',
'res_id': task.id,
})
task.attachment_ids = [(4, attachment.id)]
except Exception as e:
_logger.warning("Error attaching file %s: %s", f.filename, str(e))

return request.redirect('/your-task-has-been-submitted')

this is the xml and this is the controller of it
الكاتب

Any solution?

Unfortunately, this doesn't give a better picture of what you're actually asking.

Running you module, this is the result:
- http://localhost:8069/ --> shows home page
- http://localhost:8069/web/login --> shows login screen
- http://localhost:8069/submit/task/logged_in --> if not logged in, redirects to http://localhost:8069/web/login
- http://localhost:8069/submit/task/logged_in --> if logged in, redirects to http://localhost:8069/book-now
- http://localhost:8069/submit/task/logged_out --> if not logged in, redirects to http://localhost:8069/book-now
- http://localhost:8069/submit/task/logged_out --> if logged in, redirects to http://localhost:8069/book-now

'<t t-if="request.httprequest.path != '/web/login'">' - this doesn't make any sense since your template isn't called when that controller route is used anyways.

You may however have any issue with previous developments. Did you try to uninstall and re-install your custom module?

أفضل إجابة

I see exactly why your login page is being overridden — it’s because of this line in your template:

xml

CopierModifier

<t t-if="request.httprequest.path != '/web/login'">

You’ve wrapped the entire website.layout call (and therefore the whole page rendering) inside a condition.

If the request path is /web/login, your template skips everything, and because you registered this template as the view_id for your /book-now page but didn’t isolate it properly, it’s essentially replacing the normal /web/login page view.

In Odoo, website views and web views share the same QWeb environment, so if your template isn’t scoped to a specific route or page, it can unintentionally override default views.

How to fix

1️⃣ Remove the t-if check entirely

You don’t need:

xml

CopierModifier

<t t-if="request.httprequest.path != '/web/login'">

Odoo won’t call your /book-now page template when rendering /web/login, unless you’ve forced it via an override.

2️⃣ Scope your template only to /book-now

Right now your template is a standalone <template> without inherit_id, which means Odoo treats it as a full page view and can override other routes.

You can fix it by using the page option in your record definition:

xml

CopierModifier

<record id="custom_contact_us_page" model="website.page"> <field name="name">Book Now</field> <field name="url">/book-now</field> <field name="view_id" ref="task_extension.book_now_template"/> <field name="is_published">True</field> </record>

Make sure book_now_template does not run for other routes.

3️⃣ If you want logic to hide things on /web/login

Do that inside your page content, not wrapping the whole layout:

xml

CopierModifier

<t t-call="website.layout"> <t t-if="request.httprequest.path != '/web/login'"> <!-- Your custom sections --> </t> </t>

This way, the /web/login view still works normally.

4️⃣ Clear cache and re-install the module

Odoo caches QWeb templates in memory, so after you fix the XML:

bash

CopierModifier

./odoo-bin -u your_module_name -d your_database_name

or restart Odoo entirely.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

No, I havent ry to uninstall and reinstall it was installed at start, this is the problem 
http://localhost:8069/web/login
when i use this link it is not showing the login page, I want to know is their any problem with my code i.e controllers or xml template that is blockng anything to reach the login page, template where i login to the database....

الصورة الرمزية
إهمال
الكاتب

@Lyaazale Mouad
I have followed all your instructions
BY running this ./odoo-bin -u task_extension -d nova_plumbers
the login appears
but by running this python3 /odoo/odoo18/src/odoo-bin --xmlrpc-port=8069 --addons-path="/odoo/odoo18/src/addons,/home/arsam/odoo/odoo18/src/enterprise,/odoo/odoo18/env/nova_plumbers_uk" -u task_extension -d nova_plumbers
login not appears
i have uninstalled the module and again installed
without the module when it is in installed form it is showng the login page but when i installed the module the page of login is not showing