-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[HSCHA]: Estate Module Implementation - Tutorials #1400
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
Hansil-Chapadiya
wants to merge
17
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorial-hscha
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
17 commits
Select commit
Hold shift + click to select a range
e21f685
[ADD] estate: initialize tutorial module
Hansil-Chapadiya 1944db4
[FIX] estate: apply code formatting
Hansil-Chapadiya 2705074
[FIX] estate: put a group in that column. For the tutorial’s security…
Hansil-Chapadiya b86f660
[ADD] app: initialize new module app
Hansil-Chapadiya c130022
[ADD] app: for the tutorial’s early security chapter (ir.model.access…
Hansil-Chapadiya 7d7c43b
[FIX] app: `email.policy.default` imported but unused
Hansil-Chapadiya e2d6609
[ADD] app: added various field in model with default value and basic …
Hansil-Chapadiya c829d7d
[IMP] app: improved list and form view and split menu and view xml
Hansil-Chapadiya 9dcd47d
[IMP] app: added webicon and field in views
Hansil-Chapadiya 5f72426
[ADD] app: working with filters and custom search element
Hansil-Chapadiya 1964b2d
[FIX] estate: deleted dummy estate module
Hansil-Chapadiya d49cd43
[FIX] estate: rename app to estate module
Hansil-Chapadiya 40dd03e
[FIX] estate: fixed garden_orientation selection fields values
Hansil-Chapadiya 18055be
[FIX] estate: file name and model names are aligned with standard
Hansil-Chapadiya 8dd22b9
[ADD] estate: group_by and default filter functionality added
Hansil-Chapadiya 4aa36fd
[ADD] estate: demo data functionality added
Hansil-Chapadiya 4504a5e
[ADD] estate: estate_property_type and view of estate_ property_type …
Hansil-Chapadiya 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,4 @@ dmypy.json | |
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
| .idea/ | ||
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,16 @@ | ||
| { | ||
| "name": "Real Estate", | ||
| "depends": ["base"], | ||
| "application": True, | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", | ||
| "views/estate_property_type_views.xml", | ||
| "views/estate_property_menus.xml", | ||
| ], | ||
| "demo": [ | ||
| "demo/estate_property_demo.xml", | ||
| ], | ||
| 'author': 'Hansil Chapadiya', | ||
| 'license': 'LGPL-3' | ||
| } |
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,96 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
| <data> | ||
| <record id="property_demo_1" model="estate.property"> | ||
| <field name="name">Villa Sunset</field> | ||
| <field name="description">For Sunset Lovers with sea view</field> | ||
| <field name="date_availability">2026-10-01</field> | ||
| <field name="postcode">382016</field> | ||
| <field name="expected_price">400000000</field> | ||
| <field name="bedrooms">4</field> | ||
| <field name="living_area">4000</field> | ||
| <field name="facades">3</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">500</field> | ||
| <field name="garden_orientation">north</field> | ||
| <field name="sold">False</field> | ||
| <field name="active">True</field> | ||
| <field name="state">new</field> | ||
| </record> | ||
|
|
||
| <!-- Record 2: City Apartment --> | ||
| <record id="property_demo_2" model="estate.property"> | ||
| <field name="name">Skyline Apartment</field> | ||
| <field name="description">Modern luxury apartment in city center</field> | ||
| <field name="date_availability">2026-11-15</field> | ||
| <field name="postcode">380015</field> | ||
| <field name="expected_price">15000000</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">1200</field> | ||
| <field name="facades">1</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="sold">False</field> | ||
| <field name="active">True</field> | ||
| <field name="state">offer_received</field> | ||
| </record> | ||
|
|
||
| <!-- Record 3: Suburban House --> | ||
| <record id="property_demo_3" model="estate.property"> | ||
| <field name="name">Green Valley Bungalow</field> | ||
| <field name="description">Peaceful family home with large garden</field> | ||
| <field name="date_availability">2026-09-30</field> | ||
| <field name="postcode">382421</field> | ||
| <field name="expected_price">25000000</field> | ||
| <field name="bedrooms">3</field> | ||
| <field name="living_area">2200</field> | ||
| <field name="facades">4</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">800</field> | ||
| <field name="garden_orientation">south</field> | ||
| <field name="sold">False</field> | ||
| <field name="active">True</field> | ||
| <field name="state">offer_accepted</field> | ||
| </record> | ||
|
|
||
| <!-- Record 4: Compact Studio --> | ||
| <record id="property_demo_4" model="estate.property"> | ||
| <field name="name">Cozy Studio Flat</field> | ||
| <field name="description">Ideal for working professionals</field> | ||
| <field name="date_availability">2026-08-01</field> | ||
| <field name="postcode">380009</field> | ||
| <field name="expected_price">5000000</field> | ||
| <field name="bedrooms">1</field> | ||
| <field name="living_area">550</field> | ||
| <field name="facades">2</field> | ||
| <field name="garage">False</field> | ||
| <field name="garden">False</field> | ||
| <field name="garden_area">0</field> | ||
| <field name="sold">True</field> | ||
| <field name="active">False</field> | ||
| <field name="state">sold</field> | ||
| </record> | ||
|
|
||
| <!-- Record 5: Luxury Penthouse --> | ||
| <record id="property_demo_5" model="estate.property"> | ||
| <field name="name">Royal Heights Penthouse</field> | ||
| <field name="description">Premium penthouse with private terrace garden</field> | ||
| <field name="date_availability">2026-12-01</field> | ||
| <field name="postcode">380054</field> | ||
| <field name="expected_price">85000000</field> | ||
| <field name="bedrooms">5</field> | ||
| <field name="living_area">5500</field> | ||
| <field name="facades">4</field> | ||
| <field name="garage">True</field> | ||
| <field name="garden">True</field> | ||
| <field name="garden_area">350</field> | ||
| <field name="garden_orientation">east</field> | ||
| <field name="sold">False</field> | ||
| <field name="active">True</field> | ||
| <field name="state">new</field> | ||
| </record> | ||
| </data> | ||
| </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,2 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type |
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,50 @@ | ||
| from datetime import timedelta | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
| _order = "name" | ||
|
|
||
| name = fields.Char('Property Name', required=True, translate=True) | ||
| description = fields.Text('Property Description', required=True) | ||
| date_availability = fields.Date(copy=False, default=lambda self: fields.Date.today() + timedelta(days=3)) | ||
| postcode = fields.Char('Postal Code') | ||
| selling_price = fields.Float('Selling Price', readonly=True, copy=False, default=1000000) | ||
| expected_price = fields.Float('Expected Price', required=True) | ||
| bedrooms = fields.Integer('No of. Bedrooms', default=2) | ||
| living_area = fields.Integer('Living Area') | ||
| facades = fields.Integer('Facades') | ||
| garage = fields.Boolean('Garage', default=False) | ||
| garden = fields.Boolean('Garden', default=False) | ||
| garden_area = fields.Integer('Garden Area') | ||
| garden_orientation = fields.Selection( | ||
| selection=[ | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ], | ||
| string='Garden Orientation', | ||
| default='north' | ||
| ) | ||
| sold = fields.Boolean('Sold', default=False) | ||
| active = fields.Boolean('Active', default=True) | ||
| state = fields.Selection( | ||
| selection=[ | ||
| ('new', 'New'), | ||
| ('offer_received', 'Offer Received'), | ||
| ('offer_accepted', 'Offer Accepted'), | ||
| ('sold', 'Sold'), | ||
| ('cancelled', 'Cancelled'), | ||
| ], | ||
| string='State', | ||
| default='new', | ||
| required=True, | ||
| copy=False | ||
| ) | ||
| property_type_id = fields.Many2one("estate.property.type", string='Property Type') | ||
| buyer_id = fields.Many2one('res.partner', string='Buyer') | ||
| salesperson_id = fields.Many2one('res.users', string='Salesperson', default=lambda self: self.env.user) |
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,8 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = 'estate.property.type' | ||
| _description = 'Estate Property Type' | ||
|
|
||
| property_name = fields.Char(required=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,3 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| access_estate_property,estate.property.name,model_estate_property,base.group_user,1,1,1,1 | ||
| access_estate_property_type,estate.property.type,model_estate_property_type,base.group_user,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <odoo> | ||
| <menuitem id="menu_root" name="Real Estate" web_icon="estate,static/description/icon.png"/> | ||
| <menuitem id="first_level_menu" name="Properties" parent="menu_root"/> | ||
| <menuitem id="estate_model_menu_action" name="All Properties" parent="first_level_menu" | ||
| action="estate_property_model_action" sequence="1"/> | ||
| <menuitem id="estate_property_type_setting" name="Settings" parent="menu_root"/> | ||
| <menuitem id="estate_property_type_menu" name="Property Types" parent="estate_property_type_setting" | ||
| action="estate_property_type_action"/> | ||
| </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,8 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Types</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</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,101 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <record id="view_property_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.list</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="property_list_view"> | ||
| <field name="name"/> | ||
| <field name="description"/> | ||
| <field name="selling_price"/> | ||
| <field name="date_availability"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
| <record id="new_property_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.form</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="ADD" duplicate="false"> | ||
| <header> | ||
| <field name="state" widget="statusbar" statusbar_visible="new,offer_received,sold"/> | ||
| </header> | ||
| <sheet> | ||
| <div class="oe_title"> | ||
| <h1> | ||
| <field name="name" placeholder="e.g. Alice's villa"/> | ||
| </h1> | ||
| </div> | ||
| <group> | ||
| <group> | ||
| <field name="property_type_id"/> | ||
| <field name="date_availability"/> | ||
| <field name="selling_price"/> | ||
| </group> | ||
| <group> | ||
| <field name="postcode"/> | ||
| <field name="bedrooms"/> | ||
| <field name="living_area"/> | ||
| </group> | ||
| <group> | ||
| <field name="facades"/> | ||
| <field name="garage"/> | ||
| <field name="garden"/> | ||
| </group> | ||
| <group> | ||
| <field name="garden_area"/> | ||
| <field name="garden_orientation"/> | ||
| <field name="sold"/> | ||
| </group> | ||
| <group> | ||
| <field name="expected_price"/> | ||
| <field name="active"/> | ||
| <field name="state"/> | ||
| </group> | ||
| </group> | ||
| <notebook> | ||
| <page string="description"> | ||
| <field name="description"/> | ||
| </page> | ||
| <page string="Other info"> | ||
| <group> | ||
| <group> | ||
| <field name="salesperson_id" widget="many2one_avatar_user"/> | ||
| <field name="buyer_id" widget="many2one_avatar_user"/> | ||
| </group> | ||
| </group> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
| <record id="estate_property_model_search" model="ir.ui.view"> | ||
| <field name="name">estate.property.search</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <search> | ||
| <field name="name"/> | ||
| <field name="description"/> | ||
| <separator/> | ||
| <filter name="archived" string="Archived" domain="[('active', '=', False)]"/> | ||
| <filter name="garden" string="Garden Available" domain="[('garden', '=', True)]"/> | ||
| <filter name="state" string="Available Properties" | ||
| domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/> | ||
| <group> | ||
| <filter string="Status / State" name="group_by_state" context="{'group_by' : 'state'}"/> | ||
| <filter string="Garden Orientation" name="group_by_garden_orientation" | ||
| context="{'group_by' : 'garden_orientation'}"/> | ||
| <filter string="Postal code" name="gropu_by_postcode" context="{'group_by' : 'postcode'}"/> | ||
| </group> | ||
| </search> | ||
| </field> | ||
| </record> | ||
| <record id="estate_property_model_action" model="ir.actions.act_window"> | ||
| <field name="name">All Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="context">{'search_default_group_by_garden_orientation' : 1, 'search_default_group_by_state':1} | ||
| </field> | ||
| </record> | ||
| </odoo> |
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.
unneccary diff.
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.
Fixed in 1944db4