Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] estate: add real estate module #224

Draft
wants to merge 11 commits into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"
}
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import controllers,models,wizard
37 changes: 37 additions & 0 deletions estate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
'name': 'Estate',
'category': 'Real Estate/Brokerage',
'summary': 'Real Estate Management Module',
'description': """
This module is designed to manage real estate properties.
It allows users to store detailed information about properties,
such as name, description, price, living area, and more.
Users can also track the status of properties, availability, and other key details.
""",
'depends': [
'base', 'website'
],
'data':[
'security/security.xml',
'security/ir.model.access.csv',
'views/partner_salesman_views.xml',
'views/estate_property_offer_views.xml',
'views/estate_property_tag_views.xml',
'views/estate_property_type_views.xml',
'views/estate_property_views.xml',
'views/estate_menus.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': 'AGPL-3',
}
1 change: 1 addition & 0 deletions estate/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
44 changes: 44 additions & 0 deletions estate/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from odoo import http
from odoo.http import request


class list_properties_website(http.Controller):
@http.route([
'/properties',
'/properties/page/<int:page>',
], type='http', auth="public", website=True)

def properties(self, page=1):
items_per_page = 6
Property = request.env['estate.property']
total_properties = Property.sudo().search_count([
'&',('state','in',['new','offer_received','offer_accepted']),
('active','=',True)])

properties = Property.sudo().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,
scope=5)

return request.render('estate.property_list_template', {
'properties': properties,
'pager': pager,
})


@http.route([
'/properties/<model("estate.property"):property>',
], type='http', auth="public", website=True)

def property_details(self, property):

return request.render('estate.property_details_template', {
'property': property,
})
5 changes: 5 additions & 0 deletions estate/data/estate.property.type.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name
1,Residential
2,Commercial
3,Industrial
4,Land
147 changes: 147 additions & 0 deletions estate/demo/estate_property.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?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" />
<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" />
<field name="property_image" type="base64" file="estate/static/images/twoimage.jpg"/>

</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" />
<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>
41 changes: 41 additions & 0 deletions estate/demo/estate_property_offer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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"/>
<field name="price" >10000</field>
<field name="validity">14</field>
<field name="date_deadline" eval="datetime.now()"/>
</record>

<record id="offer_2" model="estate.property.offer">
<field name="partner_id" ref="base.res_partner_12"/>
<field name="property_id" ref="big_villa"/>
<field name="price">1500000</field>
<field name="validity">14</field>
<field name="date_deadline" eval="datetime.now()"/>

</record>

<record id="offer_3" model="estate.property.offer">
<field name="partner_id" ref="base.res_partner_2"/>
<field name="property_id" ref="big_villa"/>
<field name="price" >1500001</field>
<field name="validity">14</field>
<field name="date_deadline" eval="datetime.now()"/>

</record>


<function model="estate.property.offer" name="action_refuse_offer">
<value eval="[ref('offer_1'),ref('offer_2')]"/>
</function>

<function model="estate.property.offer" name="action_accept_offer" >
<value eval="[ref('offer_3')]"/>

</function>

</odoo>
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate_property,estate_property_offer,estate_property_tag,estate_property_type,inherited_model
Loading