Skip to content

Commit

Permalink
[IMP] estate: updated controller-added property as menu-item
Browse files Browse the repository at this point in the history
Added images to demo data for card view of properties on the
website. configured menu item named properties in the navbar.
  • Loading branch information
dija-odoo committed Jan 17, 2025
1 parent 284dcb3 commit 055f4d5
Show file tree
Hide file tree
Showing 35 changed files with 285 additions and 324 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"python.languageServer": "None"
}
}
2 changes: 1 addition & 1 deletion estate/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import models,wizard,controllers
from . import models,wizard,controllers
10 changes: 2 additions & 8 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'depends': [
'base', 'website'
],

'data':[
'security/security.xml',
'security/ir.model.access.csv',
Expand All @@ -21,23 +20,18 @@
'views/estate_property_type_views.xml',
'views/estate_property_views.xml',
'views/estate_menus.xml',
'views/estate_property_templates.xml',
'views/estate_property_website_templates.xml',
'data/estate.property.type.csv',
'report/estate_property_templates.xml',
'report/estate_property_reports.xml',
'wizard/estate_property_make_bulk_offer.xml',

],

'demo':[
'demo/estate_property.xml',
'demo/estate_property_offer.xml'

],

'application': True,
'installable':True,
'auto_install':True,
'license': 'LGPL-3',

}
}
2 changes: 1 addition & 1 deletion estate/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import main
from . import main
10 changes: 6 additions & 4 deletions estate/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odoo import http, fields, tools, models
from odoo import http
from odoo.http import request

class list_properties_website(http.Controller):
Expand All @@ -10,15 +10,17 @@ class list_properties_website(http.Controller):
def properties(self, page=1):
items_per_page = 6
Property = request.env['estate.property']
total_properties = Property.search_count([])
total_properties = Property.search_count([
'&',('state','in',['new','offer_received','offer_accepted']),
('active','=',True)])

properties = Property.search([
'&',('state','in',['new','offer_received','offer_accepted']),
('active','=',True)
], limit=items_per_page, offset=(page - 1) * items_per_page)

pager = request.website.pager(
url="/properties",

total=total_properties,
page=page,
step=items_per_page,
Expand All @@ -38,4 +40,4 @@ def property_details(self, property):

return request.render('estate.property_details_template', {
'property': property,
})
})
202 changes: 138 additions & 64 deletions estate/demo/estate_property.xml
Original file line number Diff line number Diff line change
@@ -1,74 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="big_villa" model="estate.property">
<field name="name">Big Villa</field>
<field name="state">new</field>
<field name="description">A nice and big villa</field>
<field name="postcode">12345</field>
<field name="date_availability">2020-02-02</field>
<field name="expected_price">1600000</field>
<field name="selling_price">0</field>
<field name="bedrooms">6</field>
<field name="living_area">100</field>
<field name="facades">4</field>
<field name="garage">True</field>
<field name="garden">True</field>
<field name="garden_area">100000</field>
<field name="garden_orientation">south</field>
<field name="property_type_id" ref="1" />
</record>
<record id="big_villa" model="estate.property">
<field name="name">Big Villa</field>
<field name="state">new</field>
<field name="description">A nice and big villa</field>
<field name="postcode">12345</field>
<field name="date_availability">2020-02-02</field>
<field name="expected_price">1600000</field>
<field name="selling_price">0</field>
<field name="bedrooms">6</field>
<field name="living_area">100</field>
<field name="facades">4</field>
<field name="garage">True</field>
<field name="garden">True</field>
<field name="garden_area">100000</field>
<field name="garden_orientation">south</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/oneimage.jpg"/>
</record>

<record id="trailer_home" model="estate.property">
<field name="name">Trailer home</field>
<field name="state">cancelled</field>
<field name="description">Home in a trailer park</field>
<field name="postcode">54321</field>
<field name="date_availability">1970-01-01</field>
<field name="expected_price">100000</field>
<field name="selling_price">120000</field>
<field name="bedrooms">1</field>
<field name="living_area">10</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
</record>
<record id="trailer_home" model="estate.property">
<field name="name">Trailer home</field>
<field name="state">cancelled</field>
<field name="description">Home in a trailer park</field>
<field name="postcode">54321</field>
<field name="date_availability">1970-01-01</field>
<field name="expected_price">100000</field>
<field name="selling_price">120000</field>
<field name="bedrooms">1</field>
<field name="living_area">10</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/twoimage.jpg"/>

<record id="penthouse_airy" model="estate.property">
<field name="name">Super Ventilated Pent house</field>
<field name="state">new</field>
<field name="description">airy and ventilated penthouse</field>
<field name="postcode">54321</field>
<field name="date_availability">1970-01-01</field>
<field name="expected_price">12000</field>
<field name="selling_price">1400000</field>
<field name="bedrooms">6</field>
<field name="living_area">120</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<!-- <field name="offer_ids" eval="[
Command.create({'partner_id': ref('base.res_partner_1'), 'price': 100000}),
Command.create({'partner_id': ref('base.res_partner_3'), 'price': 9877655})
]" /> -->
</record>
</record>

<record id="penthouse_airy" model="estate.property">
<field name="name">Super Ventilated Pent house</field>
<field name="state">new</field>
<field name="description">airy and ventilated penthouse</field>
<field name="postcode">54321</field>
<field name="date_availability">1970-01-01</field>
<field name="expected_price">12000</field>
<field name="selling_price">1400000</field>
<field name="bedrooms">6</field>
<field name="living_area">120</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/threeimage.jpg"/>
<field name="offer_ids" eval="[
Command.create({'partner_id': ref('base.res_partner_1'), 'price': 100000}),
Command.create({'partner_id': ref('base.res_partner_3'), 'price': 9877655})]" />
</record>

<record id="forty_acre_land" model="estate.property">
<field name="name">Forty Acre Land</field>
<field name="state">new</field>
<field name="description">Widespread and lush green land area</field>
<field name="postcode">12254</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">1500</field>
<field name="selling_price">1600</field>
<field name="bedrooms">0</field>
<field name="living_area">0</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="4" />

</record>

<record id="forty_acre_land" model="estate.property">
<field name="name">Forty Acre Land</field>
<field name="state">new</field>
<field name="description">Widespread and lush green land area</field>
<field name="postcode">12254</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">1500</field>
<field name="selling_price">1600</field>
<field name="bedrooms">0</field>
<field name="living_area">0</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="4" />
<field name="property_image" type="base64" file="estate/static/images/fourimage.jpg"/>
</record>

<record id="dragon_isle" model="estate.property">
<field name="name">Dragon Isle Villa</field>
<field name="state">new</field>
<field name="description">Super Luxurious white marble villas</field>
<field name="postcode">12641</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">250000</field>
<field name="selling_price">26000</field>
<field name="bedrooms">10</field>
<field name="living_area">2500</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/fiveimage.jpg"/>
</record>

<record id="Whole_wood_Castle" model="estate.property">
<field name="name">Premium Wood Castle</field>
<field name="state">new</field>
<field name="description">Giant Pure sag wood Castle</field>
<field name="postcode">52110</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">35000</field>
<field name="selling_price">36200</field>
<field name="bedrooms">6</field>
<field name="living_area">5000</field>
<field name="facades">6</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/siximage.jpg"/>
</record>

<record id="row_house_cozy" model="estate.property">
<field name="name">Row House</field>
<field name="state">new</field>
<field name="description">Compact Row houses</field>
<field name="postcode">350012</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">12500</field>
<field name="selling_price">35000</field>
<field name="bedrooms">6</field>
<field name="living_area">2500</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/rowhouse.jpg"/>
</record>

<record id="factory_greenwood" model="estate.property">
<field name="name">Giant MP Factory</field>
<field name="state">new</field>
<field name="description">Processing factory for sale</field>
<field name="postcode">52110</field>
<field name="date_availability">2024-01-15</field>
<field name="expected_price">1200</field>
<field name="selling_price">1300</field>
<field name="bedrooms">0</field>
<field name="living_area">0</field>
<field name="facades">4</field>
<field name="garage">False</field>
<field name="property_type_id" ref="1" />
<field name="property_image" type="base64" file="estate/static/images/factoryimage.jpg"/>
</record>

<record id="menu_properties" 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">60</field>
</record>


</odoo>
1 change: 1 addition & 0 deletions estate/demo/estate_property_offer.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- Offers are applied to big villa property -->
<record id="offer_1" model="estate.property.offer">
<field name="partner_id" ref="base.res_partner_12"/>
<field name="property_id" ref="big_villa"/>
Expand Down
6 changes: 1 addition & 5 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
from . import estate_property
from . import estate_property_type
from . import estate_property_tag
from . import estate_property_offer
from . import inherited_model
from . import estate_property,estate_property_offer,estate_property_tag,estate_property_type,inherited_model
Loading

0 comments on commit 055f4d5

Please sign in to comment.