-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[LOSBO] Real Estate Property Management - Tutorials #1407
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
losbo-odoo
wants to merge
9
commits into
odoo:19.0
Choose a base branch
from
odoo-dev:19.0-tutorial-losbo
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
9 commits
Select commit
Hold shift + click to select a range
9db77c0
[ADD] real_estate:created new module
losbo-odoo 2ad999f
[IMP] estate: added the security csv file
losbo-odoo 84049f5
[IMP] estate: added security and view files
losbo-odoo 0f1672b
[IMP] estate: added views and menu items
losbo-odoo 9e3de67
[IMP] estate: added estate_property_type table and connected the two …
losbo-odoo 9aee6a2
[IMP] estate: added property_type_id in the view xml
losbo-odoo 5269a92
[IMP] estate: add property tags, types and offers relationship
losbo-odoo c5f70d9
[IMP] estate: improved the search field and added new computed fields…
losbo-odoo 03f32ad
[FIX] estate: resolve review feedback for estate property
losbo-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,5 @@ dmypy.json | |
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
|
|
||
| .vscode | ||
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 |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| # -*- coding: utf-8 -*- | ||
| { | ||
| 'name': "Awesome Dashboard", | ||
|
|
||
| 'summary': """ | ||
| "name": "Awesome Dashboard", | ||
| "summary": """ | ||
| Starting module for "Discover the JS framework, chapter 2: Build a dashboard" | ||
| """, | ||
|
|
||
| 'description': """ | ||
| "description": """ | ||
| Starting module for "Discover the JS framework, chapter 2: Build a dashboard" | ||
| """, | ||
|
|
||
| 'author': "Odoo", | ||
| 'website': "https://www.odoo.com/", | ||
| 'category': 'Tutorials', | ||
| 'version': '0.1', | ||
| 'application': True, | ||
| 'installable': True, | ||
| 'depends': ['base', 'web', 'mail', 'crm'], | ||
|
|
||
| 'data': [ | ||
| 'views/views.xml', | ||
| "author": "Odoo", | ||
| "website": "https://www.odoo.com/", | ||
| "category": "Tutorials", | ||
| "version": "0.1", | ||
| "application": True, | ||
| "installable": True, | ||
| "depends": ["base", "web", "mail", "crm"], | ||
| "data": [ | ||
| "views/views.xml", | ||
| ], | ||
| 'assets': { | ||
| 'web.assets_backend': [ | ||
| 'awesome_dashboard/static/src/**/*', | ||
| "assets": { | ||
| "web.assets_backend": [ | ||
| "awesome_dashboard/static/src/**/*", | ||
| ], | ||
| }, | ||
| 'license': 'AGPL-3' | ||
| "license": "AGPL-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 @@ | ||
| 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,21 @@ | ||
| { | ||
| "name": "real estate", | ||
| "author": "Lokesh", | ||
| "version": "1.0.0", | ||
| "license": "LGPL-3", | ||
| # "depends": ["base"], | ||
| "application": True, | ||
| "installable": True, | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", # the order should be like this, first we need to define the views and then we need to define the action and then the menu if the order is not maintained then error will be thrown. | ||
| "views/estate_property_type_view.xml", | ||
| "views/estate_property_tag_view.xml", | ||
| "views/estate_property_menu.xml", | ||
| ], | ||
| "assets": { | ||
| "web.assets_backend": [ | ||
| "estate/static/src/estate.css", | ||
| ], | ||
| }, | ||
| } |
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_offers | ||
| from . import estate_property_tag | ||
| 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,85 @@ | ||
| from dateutil.relativedelta import relativedelta | ||
| from odoo import api | ||
| from odoo import fields | ||
| from odoo import models | ||
| from odoo.exceptions import ValidationError | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "This is a dummy table" | ||
|
|
||
| name = fields.Char(translate=True, default="Unknown", required=True) | ||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date( | ||
| copy=False, default=lambda self: fields.Date.today() + relativedelta(months=3) | ||
| ) | ||
| expected_price = fields.Float(required=True) | ||
| selling_price = fields.Float(readonly=True, copy=False) | ||
| bedrooms = fields.Integer() | ||
| living_area = fields.Integer() | ||
| facades = fields.Integer() | ||
| garage = fields.Boolean() | ||
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection( | ||
| [ | ||
| ("north", "North"), | ||
| ("south", "South"), | ||
| ("east", "East"), | ||
| ("west", "West"), | ||
| ], | ||
| string="Direction", | ||
| default="north", | ||
| ) | ||
| state = fields.Selection( | ||
| [ | ||
| ("new", "New"), | ||
| ("offer_received", "Offer Receeived"), | ||
| ("offer_accepted", "Offer Accepted"), | ||
| ("sold", "Sold"), | ||
| ("cancelled", "Cancelled"), | ||
| ] | ||
| ) | ||
| active = fields.Boolean("Active", default=True) | ||
| property_type_id = fields.Many2one("estate.property.type", string="Property Type") | ||
| property_tag_ids = fields.Many2many( | ||
| "estate.property.tag", | ||
| relation="losbo_property_propertyTag", | ||
| string="Property_Tag", | ||
| column1="estate_property_id", | ||
| column2="estate_property_tag_id", | ||
| ondelete="cascade", | ||
| ) | ||
| buyer = fields.Many2one("res.partner", string="buyer", copy=False) | ||
| user_id = fields.Many2one( | ||
| "res.users", string="salesperson", default=lambda self: self.env.user | ||
| ) | ||
| offer_ids = fields.One2many("estate.property.offers", "property_id") | ||
| total_offers = fields.Integer(compute="_compute_offers") | ||
| total_area = fields.Float(compute="_compute_area") | ||
| best_price = fields.Integer(compute="_compute_price") | ||
|
|
||
| @api.depends("offer_ids") | ||
| def _compute_offers(self): | ||
| for record in self: | ||
| record.total_offers = len(record.offer_ids) | ||
|
|
||
| @api.constrains("name", "description") | ||
| def _check_description(self): | ||
| for record in self: | ||
| if record.name == record.description: | ||
| raise ValidationError("Fields name and description should not be equal") | ||
|
|
||
| @api.depends("living_area", "garden_area") | ||
| def _compute_area(self): | ||
| for record in self: | ||
| record.total_area = record.living_area + record.garden_area | ||
|
|
||
| @api.depends("offer_ids.price") | ||
| def _compute_price(self): | ||
| for records in self: | ||
| records.best_price = max(records.offer_ids.mapped("price"), default=0) | ||
|
|
||
| # @api.onchange('') |
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,42 @@ | ||
| from datetime import date | ||
| from dateutil.relativedelta import relativedelta | ||
| from odoo import api | ||
| from odoo import fields | ||
| from odoo import models | ||
|
|
||
|
|
||
| class PropertyOffer(models.Model): | ||
| _name = "estate.property.offers" | ||
| _description = "this model is used to define the offers received to the property" | ||
|
|
||
| price = fields.Float() | ||
| status = fields.Selection([("accepted", "Accepted"), ("refused", "Refused")]) | ||
| partner_id = fields.Many2one("res.partner", required=True) | ||
| property_id = fields.Many2one("estate.property", required=True, ondelete="cascade") | ||
| deadline = fields.Date( | ||
| default=date.today(), | ||
| copy=False, | ||
| compute="_compute_deadline", | ||
| readonly=False, | ||
| # store=True, | ||
| ) | ||
| validity_days = fields.Integer( | ||
| default=0, | ||
| copy=False, | ||
| compute="_compute_validity", | ||
| readonly=False, | ||
| # store=True | ||
| ) | ||
|
|
||
| @api.depends("validity_days") | ||
| def _compute_deadline(self): | ||
| for records in self: | ||
| records.deadline = date.today() + relativedelta(days=records.validity_days) | ||
|
|
||
| @api.depends("deadline") | ||
| def _compute_validity(self): | ||
| for records in self: | ||
| diff = relativedelta(records.deadline, date.today()) | ||
| records.validity_days = diff.days | ||
|
|
||
| # def inverse_func(self): |
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 PropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "this model is used to define tags to the properties" | ||
|
|
||
| name = fields.Char(string="Tags") |
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 PropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "this is used to define the types" | ||
|
|
||
| name = fields.Char(required=True, string="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,7 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| access_estate_property_user1,estate.property.user,model_estate_property,base.group_user,1,0,0,0 | ||
| access_estate_property_user,estate.property.user,model_estate_property,base.group_system,1,1,1,1 | ||
| access_estate_property_type_user,estate.property.type.user,model_estate_property_type,base.group_user,1,1,1,1 | ||
| access_estate_property_tag_user,estate.property.tag.user,model_estate_property_tag,base.group_user,1,1,1,1 | ||
| access_estate_property_offer_user,estate.property.offer.user,model_estate_property_offers,base.group_user,1,1,1,1 | ||
| access_estate_property_tag,estate.property.tag.user,model_estate_property_tag,base.group_user,1,1,1,1 |
Empty file.
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> | ||
| <menuitem id="estate_property_menu_root" name="Real Estate"/> | ||
|
|
||
| <menuitem id="estate_menu_settings" | ||
| parent="estate_property_menu_root" | ||
| name="Settings" | ||
| sequence="2" | ||
| /> | ||
| <menuitem id="estate_menu_settings_type" | ||
| parent="estate_menu_settings" | ||
| name="Property Type" | ||
| action="estate_property_type_action" | ||
| /> | ||
| <menuitem id="estate_menu_settings_tag" | ||
| parent="estate_menu_settings" | ||
| name="Property Tag" | ||
| action = "estate_property_tag_action" | ||
| /> | ||
|
|
||
| <menuitem id="estate_menu_advertisement" | ||
| parent="estate_property_menu_root" | ||
| name="Advertisement" | ||
| sequence="1" | ||
| /> | ||
| <menuitem id="estate_menu_properties" | ||
| parent="estate_menu_advertisement" | ||
| name="properties" | ||
| action="estate_property_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,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">property tag</field> | ||
| <field name="res_model">estate.property.tag</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,23 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <odoo> | ||
| <record id="estate_property_type_view" model="ir.ui.view" > | ||
| <field name="model">estate.property.type</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="property type"> | ||
| <sheet> | ||
| <group> | ||
| <field name="name" string="Type"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!-- action --> | ||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Type</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,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.
Can you please import it as per Odoo standard?
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.
yes, I have imported as per odoo standard