-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] estate: properties menu with grid view and property details page
- Added a 'Properties' menu on the website to display available properties in a grid. - Implemented image display for properties on the front-end. - Added a pager with a maximum of 6 properties per page. - Created a dedicated, mobile-friendly page for each property using Bootstrap components.
- Loading branch information
Showing
7 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import models | ||
from . import wizard | ||
from . import report | ||
from . import controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
from . import available_properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from odoo import http | ||
from odoo.http import request | ||
|
||
|
||
class PropertyController(http.Controller): | ||
|
||
@http.route(['/properties', '/properties/page/<int:page>'], auth='public', website=True) | ||
def terms_conditions(self, page=1, **kwargs): | ||
domain = [('state', 'not in', ['sold', 'cancelled'])] | ||
total_properties = request.env["estate.property"].search_count(domain) | ||
pager = request.website.pager( | ||
url='/properties', | ||
total=total_properties, | ||
page=page, | ||
step=6, | ||
) | ||
properties = request.env['estate.property'].search(domain, limit=6, offset=pager['offset']) | ||
return request.render('estate.available_properties', { | ||
'properties': properties, | ||
'pager': pager, | ||
}) | ||
|
||
@http.route('/property/<model("estate.property"):property_avail>', auth='public', website=True) | ||
def property(self, property_avail, **kwargs): | ||
return request.render('estate.property_template', { | ||
'property': property_avail | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data> | ||
<record id="menu_property" model="website.menu"> | ||
<field name="name">Properties</field> | ||
<field name="url">/properties</field> | ||
<field name="parent_id" ref="website.main_menu"/> | ||
<field name="sequence" type="int">100</field> | ||
</record> | ||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<template id="available_properties" name="Properties Page"> | ||
<t t-call="website.layout"> | ||
<div class="container"> | ||
<h1><center>Available Properties</center></h1> | ||
<div class="row"> | ||
<t t-foreach="properties" t-as="property"> | ||
<div class="col-md-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<img src="/estate/static/description/icon.png"/> | ||
<h5 class="card-title"><t t-esc="property.name"/></h5> | ||
<p class="card-text"><t t-esc="property.expected_price"/></p> | ||
<p class="card-text"><strong>Price:</strong> <t t-esc="property.selling_price"/> USD</p> | ||
<a t-att-href="'/property/%s' % property.id" class="btn btn-primary">View Property</a> | ||
</div> | ||
</div> | ||
</div> | ||
</t> | ||
</div> | ||
<br/> | ||
<div class="col-12"> | ||
<t t-call="website.pager"> | ||
<t set="pager-url" t-value="'/properties'"/> | ||
</t> | ||
</div> | ||
</div> | ||
</t> | ||
</template> | ||
|
||
<template id="property_template"> | ||
<t t-call="website.layout"> | ||
<div class="container mt-3"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1 class="text-center mb-4"> | ||
<t t-esc="property.name"/> | ||
</h1> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<img src="/estate/static/description/icon.png" alt="Property Image"/> | ||
</div> | ||
<div class="col-md-6"> | ||
<p> | ||
<strong>Description:</strong> | ||
<t t-esc="property.description"/> | ||
</p> | ||
<p> | ||
<strong>Price:</strong> | ||
<t t-esc="property.expected_price"/> | ||
</p> | ||
<p> | ||
<strong>Bedrooms:</strong> | ||
<t t-esc="property.bedrooms"/> | ||
</p> | ||
<p> | ||
<strong>Living Area:</strong> | ||
<t t-esc="property.living_area"/>sqm</p> | ||
<t t-if="property.garden"> | ||
<p> | ||
<strong>Garden Area:</strong> | ||
<t t-esc="property.garden_area"/> sqm</p> | ||
<p> | ||
<strong>Garden Orientation:</strong> | ||
<t t-esc="property.garden_orientation"/> | ||
</p> | ||
</t> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</t> | ||
</template> | ||
</odoo> |