-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[ADD] estate: Real estate management module #926
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
base: 18.0
Are you sure you want to change the base?
Conversation
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.
Hello,
Can you please adapt your commit message and PR description according to this guideline?
https://www.odoo.com/documentation/18.0/contributing/development/git_guidelines.html
# @api.onchange("date_deadline") | ||
# def _onchange_date_deadline(self): | ||
# for offer in self: | ||
# if offer.date_deadline: | ||
# base_date = fields.Date.to_date(offer.create_date) if offer.create_date else fields.Date.context_today(offer) | ||
# offer.validity = (offer.date_deadline - base_date).days | ||
# else: | ||
# offer.validity = 0 |
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.
Do not push commented code on PR.
estate/views/estate_menus.xml
Outdated
<menuitem id="estate_property_tag_menu_action" action="estate_property_tag_action"/> | ||
</menuitem> | ||
</menuitem> | ||
</odoo> |
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.
There should be one empty line at the end of each file.
</field> | ||
</record> | ||
|
||
</odoo> |
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.
There should be one empty line at the end of each file.
</form> | ||
</field> | ||
</record> | ||
</odoo> |
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.
Same here.
</search> | ||
</field> | ||
</record> | ||
</odoo> |
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.
There should be one empty line at the end of each file.
estate/models/estate_property.py
Outdated
from odoo.exceptions import ValidationError | ||
from odoo.exceptions import UserError |
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.
from odoo.exceptions import ValidationError | |
from odoo.exceptions import UserError | |
from odoo.exceptions import UserError, ValidationError |
estate/models/estate_property.py
Outdated
elif property.state == "sold": | ||
raise UserError("A sold property cannot be cancelled.") | ||
|
||
_sql_constraints = [ |
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.
It should be defined after all field declarations.
offer.property_id.state = "offer accepted" | ||
offer.property_id.selling_price = offer.price | ||
offer.property_id.buyer_id = offer.partner_id |
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.
You can use .write() here.
for offer in self: | ||
if offer.status is False: | ||
offer.status = "refused" | ||
elif offer.status == "accepted": |
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.
In which case will this condition be true?
estate/models/estate_property_tag.py
Outdated
class EstatePropertyTag(models.Model): | ||
_name = "estate.property.tag" | ||
_description = "Estate Property Tag" | ||
_sql_constraints = [ |
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.
You can define it after the field declaration.
. Introduce a new module for real estate advertisements . Ensure it appears in the Apps list for installation . Provide basic description and dependencies for recognition . Allow it to be installed as an application (empty shell for now)
. Introduce a database model to store real estate property details . Add general information such as name, description, and location . Include availability date and pricing details for each property . Store structural attributes like bedrooms, living area, and facades . Track amenities including garage, garden, and garden size . Provide clear garden orientation with four possible directions . Ensure key details like name and expected price are always required . Enable proper persistence of property data through the ORM layer
. Ensure users can read, create, update, and delete property records . Remove warnings about missing access rules for the property model . Provide default security setup so data is accessible to standard users
…gement . Add root, first-level, and action menus to access estate properties . Introduce list and form views for property records . Make selling price read-only and prevent copy on duplication . Prevent availability date from being copied when duplicating . Set default values: 2 bedrooms and availability date in 3 months . Add active field with default True to control property visibility . Add state field (New, Offer Received, Offer Accepted, Sold, Cancelled
. Add list view showing key property fields (name, price, bedrooms, etc.) . Organize form view with groups and notebook for better readability . Add search view with filters on name and availability . Introduce filter to show only available properties (New, Offer Received) . Add shortcut to group property list by postcode
…offers . Introduce property types with menu, action and views . Link properties to a property type . Add buyer and salesperson info in property form (new tab) . Default salesperson set to current user, buyer not copied . Introduce property tags with menu, action and views . Allow assigning multiple tags to a property . Introduce property offers with price, status and partner info . Link offers to properties and show them in property form
…highlights - Property page shows total area by combining living space and garden - Best offer is displayed on property page for quick comparison - Offer page includes a deadline that updates with validity days - Editing deadline updates validity days automatically - Adding a garden enables garden details, removing it clears them - UI updated to reflect these smart behaviors clearly
…ctions - Property page now has Cancel and Sold buttons for quick status updates - Cancelled properties cannot be marked sold and vice versa - Offer page includes Accept and Refuse buttons for better offer handling - Accepting an offer sets the buyer and selling price automatically - Ensures only one offer can be accepted per property
- Prevents negative or zero amounts for property and offer prices - Ensures property types and tags must be unique - Blocks accepting offers lower than 90% of the expected price
• Introduced inline list view for property types. • Added status bar widget for property state visualization. • Set default and manual ordering for multiple models. • Included sequence field for property types to enable manual ordering. • Prevented property type editing directly from the property form. • Enabled color picker for property tags. • Adjusted button visibility based on property state. • Made garden-related fields invisible when no garden exists. • Restricted offer submissions when property is in specific states. • Made list views for offers and tags editable. • Set availability date as optional and hidden by default. • Applied visual decorations for various property and offer states. • Implemented default filter to display available properties. • Enhanced search filter for living area. • Added stat button to property types to monitor associated offers. • Filtered stat button results to display only relevant offers.
b2a13bc
to
fe42714
Compare
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.
Hello,
Can you please update your PR description according to guidelines.
https://www.odoo.com/documentation/18.0/contributing/development/git_guidelines.html#commit-message-full-description
</page> | ||
<page string="Offers"> | ||
<group> | ||
<field name = "offer_ids" readonly="state in ['offer accepted','sold','cancelled']"/> |
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.
The offer should be accepted or refused through the button only.
</menuitem> | ||
</menuitem> | ||
</odoo> | ||
|
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.
Should be one empty line at EOF.
. Prevent deletion of properties unless state is 'New' or 'Cancelled' . On offer creation: set related property state to 'Offer Received' . Raise an error if an offer is lower than an existing one . Show salesperson's available properties directly on the user form . Add a new tab in user settings to manage linked properties
fe42714
to
9b593fa
Compare
Introduce a new link module `estate_account` that depends on `estate` and `account`. This ensures that invoicing is optional and only available when both modules are installed. When a property is marked as 'Sold', an invoice is automatically created in the Invoicing application for the buyer. The invoice includes two lines: - 6% commission fee of the selling price - fixed administrative fee of 100.00 This design keeps the estate module independent while allowing integration with the accounting module for agencies that require it. By isolating this feature in a link module, we respect Odoo’s modularity principles and allow users to enable or disable invoicing without impacting the base real estate workflow.
e11a31e
to
182a5cd
Compare
Add a new Kanban view to visually display properties with a custom layout powered by QWeb templates. This improves user experience compared to the traditional list view by providing a card-like structure. The Kanban view includes: - property name and key pricing details - expected price and tags always visible - best price shown only when offers are received - selling price shown only when an offer is accepted Additionally: - properties are grouped by type by default - drag-and-drop reordering is disabled to preserve consistency This change makes property browsing more visual and intuitive, while respecting Odoo’s guidelines for modular and customizable UI components.
Overview
This PR introduces a new "Real Estate" module as part of the Odoo tutorials.
The module is designed to manage properties, offers, and property-related data.
Key Features
Property Management:
Create, update, and manage property records with essential details such as expected price, living area, garden details, and availability date.
Offer System:
Users can create multiple offers for a property. The module calculates deadlines, identifies the best offer, and allows accepting or refusing offers with proper validations.
Classification & Organization:
Properties can be tagged with customizable labels and assigned to types for better organization.
Relations and Structure:
Implemented appropriate Many2one, One2many, and Many2many relations to link properties with types, tags, and offers.
User Interface:
Designed comprehensive list and form views using Odoo’s XML templating system. Views include computed fields, smart buttons, statusbars, and domain filters for better UX.
Computed Fields & Onchange Logic:
Added business logic using computed fields (e.g., total area, best offer, etc.) and @api.onchange methods for dynamic updates in the UI.
Business Constraints:
Enforced domain rules and constraints to prevent invalid data entries (e.g., selling price must be lower than expected price).