Skip to content
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

[ADD] estate: added estate module #327

Draft
wants to merge 10 commits into
base: 18.0
Choose a base branch
from

Conversation

nmak-odoo
Copy link

@nmak-odoo nmak-odoo commented Feb 6, 2025

Created the real estate module for technical training from the documentation of server framework 101

The goal of this module is to understand multi-tier architecture and composition of a module
Understanding how elements such as business objects , object views , data files (XML & CSV) and web controllers are composited in the module.

This module is created for managing advertisements of real-estate properties
Created models by taking reference of ORM API

Models & Relationships
The following models were created under estate/models/ to define business logic and enforce relationships using Many2one, One2many, and Many2many fields:

estate.property – Represents real estate properties.
estate.property.type – Defines property categories, linked to properties via Many2one.
estate.property.tag – Implements a Many2many relation with properties for tagging.
estate.property.offer – Manages property offers, linked via a One2many to properties.

Security mechanism is implemented to allow access-rights to each model giving permissions such as read, write, create and unlink. under estate/security/ir.models.access.csv access rights are given to each model.

Views and menus are implemented under estate/views and estate/menus respectively.

@robodoo
Copy link

robodoo commented Feb 6, 2025

Pull request status dashboard

@nmak-odoo nmak-odoo changed the title test [ADD] real_estate: added real estate module Feb 6, 2025
Day 1 :
Chapter 2  : Created Folder Structure for Real-estate module
Chapter 3  : Created estate_properties model with all the basic fields
[IMP] real-estate: security , ui and search filters

Day 2 :
Chapter 4: Understood Data files(CSV) and gave access-rights
Chapter 5: Understood Data files(XML) and Implemented actions , menus and fields
Chapter 6: Understood Basic views and Implemented List , Form and Search filters
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 2 times, most recently from f7b3476 to fb43c28 Compare February 6, 2025 14:42
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello 👋,

Please add PR message and the commit messages as well.
Maintain consistency in the code.

Thank You :)

estate/test.txt Outdated Show resolved Hide resolved
estate/__manifest__.py Outdated Show resolved Hide resolved
estate/__init__.py Show resolved Hide resolved
estate/__manifest__.py Outdated Show resolved Hide resolved
estate/models/__init__.py Outdated Show resolved Hide resolved
estate/models/estate_property_tag.py Outdated Show resolved Hide resolved
estate/models/estate_property_tag.py Outdated Show resolved Hide resolved
estate/models/estate_property_tag.py Outdated Show resolved Hide resolved
estate/models/estate_property_type.py Outdated Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
@nmak-odoo nmak-odoo changed the title [ADD] real_estate: added real estate module [ADD] estate: added estate module Feb 7, 2025
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 4 times, most recently from 8d96c37 to 90b1f82 Compare February 7, 2025 08:51
Day 3:

Added Many2one relationship for property types (dropdown selection).
Added Many2many relationship for property tags (below name field).
Partially implemented One2many relationship for property offers.
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 4 times, most recently from ca74a32 to 0610372 Compare February 7, 2025 17:21
…nstrains

Day 4:
- Implemented computed field total_area as the sum of
  living_area and garden_area in estate.property.
- Added total_area to estate_property_views.xml.
- Used computed field with mapped() to define best_price as
  the maximum offer price in estate.property.
- Added inverse method for date_deadline in estate.property.offer
  - date_deadline is computed as create_date + validity days.
  - Implemented inverse method to update validity based on date_deadline.
- Added onchange method to auto-set garden_area (10) and
  orientation (North) when garden is True, and reset values
  when unset.
- Implemented property state transitions: added functionality to
  cancel and mark a property as sold.
- Used UserError for validation and error handling in business logic.
- Applied SQL constraints:
  - estate.property: applied expected_price > 0, selling_price ≥ 0.
  - estate.property.offer: applied offer_price > 0.
  - Implemented unique constraints on estate.property.tag and
    estate.property.type names.
- Implemented Python constraint in estate.property to ensure
  selling_price is at least 90% of expected_price.
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii 👋
here is a quick review.
Apart from all the below comments there are some field definitions that are missing the string property.

estate/models/estate_property_offer.py Show resolved Hide resolved
estate/views/estate_property_views.xml Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick review

estate_account/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property_type.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property_offer.py Outdated Show resolved Hide resolved
estate/models/estate_property_offer.py Outdated Show resolved Hide resolved
estate/models/estate_property_tag.py Outdated Show resolved Hide resolved
estate/views/estate_property_offer_views.xml Outdated Show resolved Hide resolved
@maad-odoo
Copy link

maad-odoo commented Feb 10, 2025

If the comments are resolved from you side please mark them as resolved 🙏

@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 4 times, most recently from 7482e90 to 6cb18b3 Compare February 11, 2025 05:54
…n view

Day 5:
Added inline list view inside property type model's form view to view properties
linked with each type.

Added statusbar widget for displaying Four states such as New, Offer Received,
Offer Accepted and Sold.

Added Model ordering and Manual ordering(using sequence) in list view's of
estate.property,estate.property.type,estate.property.tag and property.offer
along with widget options for adding colors and conditional display of buttons
by using 'invisible' attribute in the field.Also added stat button

Added business logic to CRUD methods using python inheritance.
added ResUsers class inheriting res.users model setting one2many relationship
b/w a user and properties linked with that user.
added properties to base.view_users_form

Created estate_account module for invoicing of the properties sold

Added kanban view to the properties section grouped by property type.
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 2 times, most recently from 72cad0d to a44515d Compare February 11, 2025 13:35
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii 👋

here are few more comments.

estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate_account/__manifest__.py Outdated Show resolved Hide resolved
estate_account/models/estate_property.py Show resolved Hide resolved
estate_account/models/estate_property.py Outdated Show resolved Hide resolved
estate_account/models/estate_property.py Outdated Show resolved Hide resolved
estate_account/models/estate_property.py Outdated Show resolved Hide resolved
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 5 times, most recently from c25b542 to 453b6fd Compare February 12, 2025 06:15
Day 6:
Added security.xml file for defining groups (agents and managers) and
record rules restricting access to data for agents.
Added model access rights for agents and managers inside ir.security.access.csv
updated estate_account model for bypassing access rights and rules when creating
the invoice using sudo() method
used check_access for both rules and rights to ensure that the current user can
update the property the invoice is for, before creating the invoice
added multi-company security to restrict agents to their company's properties
Hide settings menu for agents , by giving its right to only estate_group_manager
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 2 times, most recently from 147401f to 020de0d Compare February 12, 2025 12:35
…mo data

Day 7:
Added Dynamic sequencing for properties (e.g: P0001, P0002, etc)

Added Demo Data for Properties & Offers

Added demo data for properties with all relevant fields.

Created demo views (estate_property_demo.xml, estate_property_type_demo.xml,
estate_property_offer_demo.xml) under the estate/demo/ directory.

Added property offers using existing partners from the base module.

Created multiple offers on a single property using the One2many field.

fixed code structure and formatting
Day 8:
add property offers pdf report and added conditions (t-if and t-else) for
properties with no offers.

add pdf report for res.users which prints all the real estate properties that
are visible in their form view.

add invoicing information by inheriting the estate_report in estate module to
estate_account module

add unit tests to check no one create an offer for a sold property and sell a
property with no accepted offers to it.

add unit test to make sure that garden area and orientation resets back without
breaking.
Day 9:
add counter component to display
extract counter component in a sub component
add card component
add markup to display html
add props validation
add sum of two counter components
add todo list
    -add dynamic attributes to mute and line-through tasks which are done
    -add todo function
    -add custom hook useAutoFocus to focus input
    -add toggle todo and delete todo function
add generic card with slots
add toggle in card to minimize card content
…hart

Day 10:
add new layout
add buttons for quick navigation ('customers' and 'leads')
add dashboard item
add statistics by rpc call to api route
add memoization of rpc calls for caching
display pie chart with stats data
add regular reloads of data every 10 mins.
lazy loading using LazyComponent
generic dashboard
register dashboard items in awesome_dashboard registry
add and remove dashboard items using control panel
translation of dashboard items title using _t
@nmak-odoo nmak-odoo force-pushed the 18.0-training-nmak branch 3 times, most recently from b51df60 to ba51a3f Compare February 18, 2025 12:41
…ties

Day 11:
add available properties (which are yet to be sold and not cancelled/archived)
 in a grid along with its details and image.
add image field to the property and on form view as well
add pagination using website.pager limiting only 6 properties per page.
add property_details page which gives more details about the property
add date-picker to select date and button 'Listed After' to list properties which are
 available after the selected date in descending order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants