-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[ADD] estate: initialize estate module #1333
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
vrushibh
wants to merge
6
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorials-vrbha
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
6 commits
Select commit
Hold shift + click to select a range
b1adea6
[ADD] estate: initialize estate module
vrushibh 8594029
[ADD] estate: add estate.property model and basic fields
vrushibh 10c70a5
[ADD] estate: add security access rules for estate.property
vrushibh 8fb2322
[ADD] estate: add basic views, action and menus
vrushibh 67d44d9
[IMP] estate: add tag and offer models with relations
vrushibh e65e22a
[FIX] estate: address TL review feedback and add demo data
vrushibh 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 |
|---|---|---|
| @@ -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,19 @@ | ||
| # -*- coding: utf-8 -*- | ||
| { | ||
| "name": "Real Estate", | ||
| "author": "Odoo S.A.", | ||
| "license": "LGPL-3", | ||
| "depends": ["base"], | ||
| "data": [ | ||
| "security/estate_security.xml", | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", | ||
| "views/estate_property_type_views.xml", | ||
| "views/estate_property_tag_views.xml", | ||
| "views/estate_property_offer_views.xml", | ||
| "views/estate_menus.xml", | ||
| "data/estate_demo.xml", | ||
| ], | ||
| "application": True, | ||
| "installable": 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,69 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_type_residential" model="estate.property.type"> | ||
| <field name="name">Residential</field> | ||
| </record> | ||
| <record id="estate_property_type_commercial" model="estate.property.type"> | ||
| <field name="name">commercial</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_cozy" model="estate.property.tag"> | ||
| <field name="name">Cozy</field> | ||
| </record> | ||
| <record id="estate_property_tag_cool" model="estate.property.tag"> | ||
| <field name="name">Cool</field> | ||
| </record> | ||
| <record id="estate_property_tag_nice" model="estate.property.tag"> | ||
| <field name="name">Nice</field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_demo_1" model="estate.property"> | ||
| <field name="name">vrushibh Apartment</field> | ||
| <field name="expected_price">75000.00</field> | ||
| <field name="bedrooms">4</field> | ||
| <field name="living_area">250</field> | ||
| <field name="postcode">35000</field> | ||
| <field name="date_availability">2026-09-15</field> | ||
| <field name="property_type_id" ref="estate_property_type_residential"/> | ||
| <field name="tag_ids" eval="[(6, 0, [ref('estate_property_tag_cool'), ref('estate_property_tag_nice')])]"/> | ||
| </record> | ||
|
|
||
| <record id="estate_property_demo_2" model="estate.property"> | ||
| <field name="name">Cozy Apartment</field> | ||
| <field name="expected_price">200000.00</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">85</field> | ||
| <field name="postcode">380001</field> | ||
| <field name="property_type_id" ref="estate_property_type_commercial"/> | ||
| <field name="tag_ids" eval="[(6, 0, [ref('estate_property_tag_cool'), ref('estate_property_tag_nice')])]"/> | ||
| </record> | ||
|
|
||
| <record id="estate_property_demo_3" model="estate.property"> | ||
| <field name="name">nice Apartment</field> | ||
| <field name="expected_price">206000.00</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">85</field> | ||
| <field name="postcode">380001</field> | ||
| <field name="property_type_id" ref="estate_property_type_commercial"/> | ||
| </record> | ||
|
|
||
| <record id="estate_property_demo_4" model="estate.property"> | ||
| <field name="name">cool Apartment</field> | ||
| <field name="expected_price">206000.00</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">85</field> | ||
| <field name="postcode">380001</field> | ||
| <field name="property_type_id" ref="estate_property_type_commercial"/> | ||
| </record> | ||
|
|
||
| <record id="estate_property_demo_5" model="estate.property"> | ||
| <field name="name">jumbo Apartment</field> | ||
| <field name="expected_price">206000.00</field> | ||
| <field name="bedrooms">2</field> | ||
| <field name="living_area">85</field> | ||
| <field name="postcode">380001</field> | ||
| <field name="property_type_id" ref="estate_property_type_commercial"/> | ||
| </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_tag | ||
| from . import estate_property_type | ||
| 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,53 @@ | ||
| from dateutil.relativedelta import relativedelta | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
|
|
||
| name = fields.Char(required=True, string="Property Name") | ||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date( | ||
| default=lambda self: fields.Date.context_today(self) + relativedelta(months=3) | ||
| ) | ||
| expected_price = fields.Float(required=True, copy=False, default=0.0) | ||
| selling_price = fields.Float(readonly=True, copy=False) | ||
| bedrooms = fields.Integer(default=2) | ||
| living_area = fields.Integer() | ||
| facades = fields.Integer() | ||
| garage = fields.Boolean() | ||
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection( | ||
| selection=[ | ||
| ('north', "North"), | ||
| ('south', "South"), | ||
| ('east', "East"), | ||
| ('west', "West"), | ||
| ], | ||
|
vrushibh marked this conversation as resolved.
|
||
| string="Garden Orientation", | ||
| ) | ||
| active = fields.Boolean(default=True) | ||
| state = fields.Selection( | ||
| selection=[ | ||
| ('new', "New"), | ||
| ('offer_received', "Offer Received"), | ||
| ('offer_accepted', "Offer Accepted"), | ||
| ('sold', "Sold"), | ||
| ('cancelled', "Cancelled"), | ||
| ], | ||
| required=True, | ||
| copy=False, | ||
| default="new", | ||
| string="State", | ||
| ) | ||
| property_type_id = fields.Many2one("estate.property.type", string="Property Type") | ||
| buyer_id = fields.Many2one("res.partner", string="Buyer", copy=False) | ||
| salesperson_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") | ||
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,18 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyOffer(models.Model): | ||
| _name = "estate.property.offer" | ||
| _description = "Real Estate Property Offer" | ||
|
|
||
| price = fields.Float(required=True) | ||
| status = fields.Selection( | ||
| selection=[ | ||
| ('accepted', 'Accepted'), | ||
| ('rejected', 'Rejected'), | ||
| ], | ||
| copy=False, | ||
| string="Status", | ||
| ) | ||
| partner_id = fields.Many2one("res.partner", string="Partner",required=True) | ||
| property_id = fields.Many2one("estate.property", string="Property", 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,10 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Real Estate Property Tag" | ||
|
|
||
| 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,8 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Real Estate Property Type" | ||
|
|
||
| name = fields.Char(required=True, string="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,27 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="module_category_real_estate" model="ir.module.category"> | ||
| <field name="name">Real Estate</field> | ||
| <field name="sequence">10</field> | ||
| </record> | ||
|
|
||
| <record id="res_groups_privilege_estate" model="res.groups.privilege"> | ||
| <field name="name">Access Level</field> | ||
| <field name="category_id" ref="module_category_real_estate"/> | ||
| </record> | ||
|
|
||
| <record id="estate_group_agent" model="res.groups"> | ||
| <field name="name">Agent</field> | ||
| <field name="privilege_id" ref="res_groups_privilege_estate"/> | ||
| <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> | ||
| </record> | ||
|
|
||
| <record id="estate_group_manager" model="res.groups"> | ||
| <field name="name">Manager</field> | ||
| <field name="privilege_id" ref="res_groups_privilege_estate"/> | ||
| <field name="implied_ids" eval="[(4, ref('estate_group_agent'))]"/> | ||
| <field name="user_ids" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/> | ||
| </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,9 @@ | ||
| id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink | ||
| access_estate_property_agent,access_estate_property_agent,model_estate_property,estate_group_agent,1,1,1,0 | ||
| access_estate_property_manager,access_estate_property_manager,model_estate_property,estate_group_manager,1,1,1,1 | ||
| access_estate_property_type_agent,access_estate_property_type_agent,model_estate_property_type,estate_group_agent,1,1,1,1 | ||
| access_estate_property_type_manager,access_estate_property_type_manager,model_estate_property_type,estate_group_manager,1,1,1,1 | ||
| access_estate_property_tag_agent,access_estate_property_tag_agent,model_estate_property_tag,estate_group_agent,1,1,1,1 | ||
| access_estate_property_tag_manager,access_estate_property_tag_manager,model_estate_property_tag,estate_group_manager,1,1,1,1 | ||
| access_estate_property_offer_agent,access_estate_property_offer_agent,model_estate_property_offer,estate_group_agent,1,1,1,1 | ||
| access_estate_property_offer_manager,access_estate_property_offer_manager,model_estate_property_offer,estate_group_manager,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,36 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <menuitem | ||
| id="estate_menu_root" | ||
| name="Real Estate" | ||
| sequence="10" | ||
| web_icon="estate,static/description/icon.png"/> | ||
|
|
||
| <menuitem | ||
| id="estate_property_menu_advertisements" | ||
| name="Advertisements" | ||
| parent="estate_menu_root" | ||
| sequence="10"/> | ||
|
|
||
| <menuitem | ||
| id="estate_property_menu" | ||
| name="Properties" | ||
| parent="estate_property_menu_advertisements" | ||
| action="estate_property_action" | ||
| sequence="10"/> | ||
|
|
||
| <menuitem | ||
| id="estate_property_menu_settings" | ||
| name="Settings" | ||
| parent="estate_menu_root" | ||
| sequence="20"/> | ||
|
|
||
| <menuitem | ||
| id="estate_property_type_menu" | ||
| name="Property Types" | ||
| parent="estate_property_menu_settings" | ||
| action="estate_property_type_action" | ||
| sequence="10"/> | ||
|
|
||
| </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 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_offer_view_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.offer.view.list</field> | ||
| <field name="model">estate.property.offer</field> | ||
| <field name="arch" type="xml"> | ||
| <list> | ||
| <field name="partner_id"/> | ||
| <field name="price"/> | ||
| <field name="status"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_offer_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.offer.view.form</field> | ||
| <field name="model">estate.property.offer</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Offer"> | ||
| <sheet> | ||
| <group> | ||
| <field name="partner_id"/> | ||
| <field name="price"/> | ||
| <field name="status"/> | ||
| </group> | ||
| </sheet> | ||
| </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,39 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Tags</field> | ||
| <field name="res_model">estate.property.tag</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| Create your first property tag! | ||
| </p> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_view_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.tag.view.list</field> | ||
| <field name="model">estate.property.tag</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Property Tags"> | ||
| <field name="name"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.tag.view.form</field> | ||
| <field name="model">estate.property.tag</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Property Tag"> | ||
| <sheet> | ||
| <group> | ||
| <field name="name"/> | ||
| </group> | ||
| </sheet> | ||
| </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,39 @@ | ||
| <?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> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| Create your first property type! | ||
| </p> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_view_list" model="ir.ui.view"> | ||
| <field name="name">estate.property.type.view.list</field> | ||
| <field name="model">estate.property.type</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Property Types"> | ||
| <field name="name"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.type.view.form</field> | ||
| <field name="model">estate.property.type</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Property Type"> | ||
| <sheet> | ||
| <group> | ||
| <field name="name"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| </odoo> |
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.
What if we don't write
basehere?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.
If we don't write base, Odoo will still load it automatically. However, writing it explicitly is a best practice to make the module dependency clear.