-
Notifications
You must be signed in to change notification settings - Fork 3k
Developing a real estate advertisement module from scratch #1188
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
Draft
pasaw-odoo
wants to merge
7
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorials-estate-pasaw
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b78ab6
[ADD] estate: finish Chapters 2-4 (module & model)
pasaw-odoo 83d1383
[ADD] estate: chapter 5 and chapter 6 (list and forms done)
pasaw-odoo b97eef7
[IMP] estate:chapter 6
pasaw-odoo 1809d22
[ADD] estate: chapter 7 completed
pasaw-odoo cb8ff1b
[IMP] estate: fix linting issues
pasaw-odoo 722f7fb
[IMP] estate: some improvements till chapter 7
pasaw-odoo 68a2994
[REM] tutorials: remove README.md
pasaw-odoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -127,3 +127,8 @@ dmypy.json | |
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
|
|
||
| # Ignore README files | ||
| README | ||
| README.* | ||
| README.md | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 @@ | ||
| from . import models |
This file contains hidden or 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 @@ | ||
| { | ||
| 'name': 'Real Estate', | ||
| 'version': '1.0', | ||
| 'license': 'LGPL-3', | ||
| 'summary': 'Real estate advertisement management', | ||
| 'description': """ | ||
| Real Estate tutorial module. | ||
| """, | ||
| 'author': 'Parth Sawant', | ||
| 'depends': ['base'], | ||
| 'category': 'Real Estate', | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_property_type_views.xml', | ||
| 'views/estate_property_tags_views.xml', | ||
| 'views/estate_property_offer_views.xml', | ||
| 'views/estate_menus.xml', | ||
|
|
||
| ], | ||
| 'demo': [ | ||
| 'demo/demo.xml', | ||
| 'demo/demo_tag.xml', | ||
| 'demo/demo_type.xml', | ||
| ], | ||
| 'application': True, | ||
| } |
This file contains hidden or 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,195 @@ | ||
| <odoo noupdate="1"> | ||
| <record id="property_1" model="estate.property"> | ||
| <field name="name">Modern Downtown Apartment</field> | ||
| <field name="description">Sleek apartment in the heart of the city</field> | ||
| <field name="postcode">10001</field> | ||
| <field name="date_availability">2025-06-01</field> | ||
| <field name="expected_price">250000</field> | ||
| <field name="selling_price">245000</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">85</field> | ||
| <field name="facades">1</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="garden_orientation">north</field> | ||
| </record> | ||
|
|
||
| <record id="property_2" model="estate.property"> | ||
| <field name="name">Suburban Family Home</field> | ||
| <field name="description">Spacious home with a large backyard</field> | ||
| <field name="postcode">20002</field> | ||
| <field name="date_availability">2025-07-15</field> | ||
| <field name="expected_price">450000</field> | ||
| <field name="selling_price">440000</field> | ||
| <field name="bedrooms">4</field> | ||
| <field name="living_area">180</field> | ||
| <field name="facades">3</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">120</field> | ||
| <field name="garden_orientation">south</field> | ||
| </record> | ||
|
|
||
| <record id="property_3" model="estate.property"> | ||
| <field name="name">Cozy Studio Near University</field> | ||
| <field name="description">Compact studio ideal for students</field> | ||
| <field name="postcode">30003</field> | ||
| <field name="date_availability">2025-05-01</field> | ||
| <field name="expected_price">95000</field> | ||
| <field name="selling_price">90000</field> | ||
| <field name="bedrooms">1</field> | ||
| <field name="living_area">35</field> | ||
| <field name="facades">1</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="garden_orientation">east</field> | ||
| </record> | ||
|
|
||
| <record id="property_4" model="estate.property"> | ||
| <field name="name">Luxury Beachfront Villa</field> | ||
| <field name="description">Stunning villa with direct beach access</field> | ||
| <field name="postcode">40004</field> | ||
| <field name="date_availability">2025-09-01</field> | ||
| <field name="expected_price">1200000</field> | ||
| <field name="selling_price">1150000</field> | ||
| <field name="bedrooms">5</field> | ||
| <field name="living_area">350</field> | ||
| <field name="facades">4</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">500</field> | ||
| <field name="garden_orientation">south</field> | ||
| </record> | ||
|
|
||
| <record id="property_5" model="estate.property"> | ||
| <field name="name">Countryside Cottage</field> | ||
| <field name="description">Charming cottage surrounded by nature</field> | ||
| <field name="postcode">50005</field> | ||
| <field name="date_availability">2025-08-01</field> | ||
| <field name="expected_price">175000</field> | ||
| <field name="selling_price">170000</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">90</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">200</field> | ||
| <field name="garden_orientation">west</field> | ||
| </record> | ||
|
|
||
| <record id="property_6" model="estate.property"> | ||
| <field name="name">City Center Penthouse</field> | ||
| <field name="description">Exclusive penthouse with panoramic views</field> | ||
| <field name="postcode">60006</field> | ||
| <field name="date_availability">2025-10-01</field> | ||
| <field name="expected_price">850000</field> | ||
| <field name="selling_price">820000</field> | ||
| <field name="bedrooms">3</field> | ||
| <field name="living_area">210</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="garden_orientation">north</field> | ||
| </record> | ||
|
|
||
| <record id="property_7" model="estate.property"> | ||
| <field name="name">Industrial Loft Conversion</field> | ||
| <field name="description">Trendy loft in a converted warehouse</field> | ||
| <field name="postcode">70007</field> | ||
| <field name="date_availability">2025-06-15</field> | ||
| <field name="expected_price">320000</field> | ||
| <field name="selling_price">310000</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">130</field> | ||
| <field name="facades">1</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="garden_orientation">east</field> | ||
| </record> | ||
|
|
||
| <record id="property_8" model="estate.property"> | ||
| <field name="name">Hillside Bungalow</field> | ||
| <field name="description">Peaceful bungalow with valley views</field> | ||
| <field name="postcode">80008</field> | ||
| <field name="date_availability">2025-07-01</field> | ||
| <field name="expected_price">290000</field> | ||
| <field name="selling_price">280000</field> | ||
| <field name="bedrooms">3</field> | ||
| <field name="living_area">110</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">80</field> | ||
| <field name="garden_orientation">west</field> | ||
| </record> | ||
|
|
||
| <record id="property_9" model="estate.property"> | ||
| <field name="name">Gated Community Townhouse</field> | ||
| <field name="description">Secure townhouse in a premium gated complex</field> | ||
| <field name="postcode">90009</field> | ||
| <field name="date_availability">2025-11-01</field> | ||
| <field name="expected_price">530000</field> | ||
| <field name="selling_price">515000</field> | ||
| <field name="bedrooms">3</field> | ||
| <field name="living_area">150</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">60</field> | ||
| <field name="garden_orientation">south</field> | ||
| </record> | ||
|
|
||
| <record id="property_10" model="estate.property"> | ||
| <field name="name">Riverside Duplex</field> | ||
| <field name="description">Beautiful duplex with riverside views</field> | ||
| <field name="postcode">10010</field> | ||
| <field name="date_availability">2025-08-15</field> | ||
| <field name="expected_price">390000</field> | ||
| <field name="selling_price">375000</field> | ||
| <field name="bedrooms">4</field> | ||
| <field name="living_area">160</field> | ||
| <field name="facades">3</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">90</field> | ||
| <field name="garden_orientation">east</field> | ||
| </record> | ||
|
|
||
| <record id="property_11" model="estate.property"> | ||
| <field name="name">Mountain Cabin Retreat</field> | ||
| <field name="description">Rustic cabin with stunning mountain views</field> | ||
| <field name="postcode">11011</field> | ||
| <field name="date_availability">2025-09-15</field> | ||
| <field name="expected_price">210000</field> | ||
| <field name="selling_price">200000</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">75</field> | ||
| <field name="facades">1</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">150</field> | ||
| <field name="garden_orientation">south</field> | ||
|
|
||
| </record> | ||
|
|
||
| <record id="property_12" model="estate.property"> | ||
| <field name="name">Historic Downtown Loft</field> | ||
| <field name="description">Unique loft in a historic building</field> | ||
| <field name="postcode">12012</field> | ||
| <field name="date_availability">2025-10-15</field> | ||
| <field name="expected_price">280000</field> | ||
| <field name="selling_price">270000</field> | ||
| <field name="bedrooms">1</field> | ||
| <field name="living_area">95</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="garden_orientation">north</field> | ||
| </record> | ||
| </odoo> | ||
|
|
This file contains hidden or 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,43 @@ | ||
| <odoo noupdate="1"> | ||
|
|
||
| <record id="estate_tag_cozy" model="estate.property.tag"> | ||
| <field name="name">Cozy</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_modern" model="estate.property.tag"> | ||
| <field name="name">Modern</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_luxury" model="estate.property.tag"> | ||
| <field name="name">Luxury</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_renovated" model="estate.property.tag"> | ||
| <field name="name">Renovated</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_new_build" model="estate.property.tag"> | ||
| <field name="name">New Build</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_sea_view" model="estate.property.tag"> | ||
| <field name="name">Sea View</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_city_center" model="estate.property.tag"> | ||
| <field name="name">City Center</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_quiet" model="estate.property.tag"> | ||
| <field name="name">Quiet Neighborhood</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_pet_friendly" model="estate.property.tag"> | ||
| <field name="name">Pet Friendly</field> | ||
| </record> | ||
|
|
||
| <record id="estate_tag_gated" model="estate.property.tag"> | ||
| <field name="name">Gated Community</field> | ||
| </record> | ||
|
|
||
| </odoo> |
This file contains hidden or 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,31 @@ | ||
| <odoo noupdate="1"> | ||
|
|
||
| <record id="estate_property_type_apartment" model="estate.property.type"> | ||
| <field name="name">Apartment</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_house" model="estate.property.type"> | ||
| <field name="name">House</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_villa" model="estate.property.type"> | ||
| <field name="name">Villa</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_studio" model="estate.property.type"> | ||
| <field name="name">Studio</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_land" model="estate.property.type"> | ||
| <field name="name">Land</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_commercial" model="estate.property.type"> | ||
| <field name="name">Commercial</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_industrial" model="estate.property.type"> | ||
| <field name="name">Industrial</field> | ||
| </record> | ||
|
|
||
| </odoo> |
This file contains hidden or 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,4 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type | ||
| from . import estate_property_tag | ||
| from . import estate_property_offer |
This file contains hidden or 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,57 @@ | ||||||||||||||||||||||||||
| from dateutil.relativedelta import relativedelta | ||||||||||||||||||||||||||
| from odoo import fields, models | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| class EstateProperty(models.Model): | ||||||||||||||||||||||||||
| _name = 'estate.property' | ||||||||||||||||||||||||||
| _description = 'Real Estate Property' | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| name = fields.Char(string="Property Name", required=True, help='Enter the name of the property') | ||||||||||||||||||||||||||
| image = fields.Image(string="Property Image", max_width=1024, max_height=1024) | ||||||||||||||||||||||||||
| description = fields.Text(string="Property Description", help='Enter a description of the property') | ||||||||||||||||||||||||||
| postcode = fields.Char(string="Postcode", help='Enter the postcode of the property') | ||||||||||||||||||||||||||
| date_availability = fields.Date( | ||||||||||||||||||||||||||
| string="Availability Date", | ||||||||||||||||||||||||||
| help='Enter the date when the property becomes available', | ||||||||||||||||||||||||||
| copy=False, | ||||||||||||||||||||||||||
| default=lambda self: fields.Date.today() + relativedelta(months=3) | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| expected_price = fields.Float(string="Expected Price", required=True, help='Enter the expected price of the property') | ||||||||||||||||||||||||||
| selling_price = fields.Float(string="Selling Price", help='Enter the selling price of the property', readonly=True, copy=False) | ||||||||||||||||||||||||||
| bedrooms = fields.Integer(string="Number of Bedrooms", help='Enter the number of bedrooms in the property', default=2) | ||||||||||||||||||||||||||
| living_area = fields.Integer(string="Living Area", help='Enter the living area of the property in square meters') | ||||||||||||||||||||||||||
| facades = fields.Integer(string="Number of Facades", help='Enter the number of facades of the property') | ||||||||||||||||||||||||||
| garage = fields.Boolean(string="Garage", help='Check if the property has a garage') | ||||||||||||||||||||||||||
| garden = fields.Boolean(string="Garden", help='Check if the property has a garden') | ||||||||||||||||||||||||||
| garden_area = fields.Integer(string="Garden Area", help='Enter the area of the garden in square meters') | ||||||||||||||||||||||||||
| garden_orientation = fields.Selection( | ||||||||||||||||||||||||||
| selection=[ | ||||||||||||||||||||||||||
| ('north', "North"), | ||||||||||||||||||||||||||
| ('south', "South"), | ||||||||||||||||||||||||||
| ('east', "East"), | ||||||||||||||||||||||||||
| ('west', "West"), | ||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||
|
Comment on lines
+28
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
keep the key in single quotes and value in double quotes |
||||||||||||||||||||||||||
| string="Garden Orientation", | ||||||||||||||||||||||||||
| help='Select the orientation of the garden' | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| active = fields.Boolean(string="Active", default=True, help='Set to False to archive the property') | ||||||||||||||||||||||||||
| state = fields.Selection( | ||||||||||||||||||||||||||
| selection=[ | ||||||||||||||||||||||||||
| ('new', "New Offer"), | ||||||||||||||||||||||||||
| ('offer_received', "Offer Received"), | ||||||||||||||||||||||||||
| ('offer_accepted', "Offer Accepted"), | ||||||||||||||||||||||||||
| ('sold', "Sold"), | ||||||||||||||||||||||||||
| ('canceled', "Canceled") | ||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||
| string="Status", | ||||||||||||||||||||||||||
| required=True, | ||||||||||||||||||||||||||
| copy=False, | ||||||||||||||||||||||||||
| default='new', | ||||||||||||||||||||||||||
| help='Current status of the property' | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| property_type_id = fields.Many2one('estate.property.type', string="Property Type") | ||||||||||||||||||||||||||
| buyer_id = fields.Many2one('res.partner', string="Buyer", copy=False) | ||||||||||||||||||||||||||
| seller_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| tag_ids = fields.Many2many('estate.property.tag', string="Property Tags") | ||||||||||||||||||||||||||
| offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers") | ||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow these guidelines to import in a correct order and proper format.