Skip to content

[ADD] estate,*: added real estate module #848

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
wants to merge 13 commits into
base: 18.0
Choose a base branch
from

Conversation

rvar-odoo
Copy link

@rvar-odoo rvar-odoo commented Jul 9, 2025

*=estate_account

-Added base estate and estate_account modules with models, security rules, and basic views.
-Implemented relational fields (many2one, one2many, many2many) and computed fields with dependencies.
-Added onchange methods for dynamic form behaviors.
-Created server actions, constraints, and automated workflows to enhance business logic.
-Developed PDF reports for property offers using QWeb and extended them in estate_account to include invoice details.
-Integrated mixins, HTTP controllers, and data loading mechanisms.
-Organized templates, report actions, and updated manifest files for proper module structure.
-Enabled data loading and module inheritance for extended functionality.

Created new 'estate' module.
Added base model 'estate.property' with fields mentioned in exercise.
Set up module structure.
Set 'name' and 'expected_price' as required fields.
@robodoo
Copy link

robodoo commented Jul 9, 2025

Pull request status dashboard

@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch 4 times, most recently from 93657db to b6e2c1e Compare July 10, 2025 06:55
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.

Quick first review.

Remove the unnecessary diff added in the code base.
Also the PR title is not correct, please adapt that as well

@@ -0,0 +1 @@
from . import models

Choose a reason for hiding this comment

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

Missing licensing

"installable": True,
"depends": ["base"],
"application": True,
"auto_install": False,

Choose a reason for hiding this comment

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

If the value is false, then no need to define it anyways

Comment on lines 4 to 5
"summary": "Demo app for estate",
"description": "This is the demo app ",

Choose a reason for hiding this comment

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

Add a proper summary and description

Comment on lines 7 to 9
class RecurringPlan(models.Model):
_name = "estate.property"
_description = "estate property revenue plans"

Choose a reason for hiding this comment

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

Mismatch class name and model name

class RecurringPlan(models.Model):
_name = "estate.property"
_description = "estate property revenue plans"
_order = "id desc" # For ordering in ascending opr descending order one more way to do so is from view like: <list default_order="date desc">

Choose a reason for hiding this comment

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

Comment is not required here

Comment on lines 60 to 74
# Allow only if property has no accepted offer
if offer.property_id.buyer_id:
raise UserError(
_("An offer has already been accepted for this property.")
)
# Set buyer and selling price
offer.property_id.buyer_id = offer.partner_id
offer.property_id.selling_price = offer.price
offer.status = "accepted"
offer.property_id.state = "offer_accepted"
# Setting remaining Offer as refused
other_offers = offer.property_id.offer_id - offer
# for other in other_offers: # -----> Normal for loop logic
# other.status = 'refused'
other_offers.write({"status": "refused"}) # -----> Odoo ORM Method

Choose a reason for hiding this comment

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

Comment are unnecesary


return super().create(new_records)

# vals_list---------> [{'partner_id': 23, 'price': 100, 'validity': 7, 'date_deadline': '2025-07-16', 'property_id': 19}]

Choose a reason for hiding this comment

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

Unnecessary

access_estate_model,estate.property,model_estate_property,base.group_user,1,1,1,1
access_estate_model_property,estate.property.type,model_estate_property_type,base.group_user,1,1,1,1
access_estate_model_tag,estate.property.tag,model_estate_property_tag,base.group_user,1,1,1,1
access_estate_model_offer,estate.property.offer,model_estate_property_offer,base.group_user,1,1,1,1

Choose a reason for hiding this comment

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

End of file line is missing

</field>

</record>
</odoo>

Choose a reason for hiding this comment

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

End of file line is missing

Comment on lines 14 to 16
journal = self.env["account.journal"].search(
[("type", "=", "sale")], limit=1
)

Choose a reason for hiding this comment

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

Do you think searching inside for loop is efficient way to do it ?

@rvar-odoo rvar-odoo changed the title 18.0 training rvar [ADD] estate,*: added real estate module Jul 14, 2025
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch 3 times, most recently from 454d05d to 127ad83 Compare July 15, 2025 13:29
-Defined access rights and security rules for proper user control.
-Created simple form and tree views for the module UI.
-Established foundational structure for further feature development.
-Follows Odoo 18 developer tutorial to demonstrate ORM, security, and views.
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from 127ad83 to f32463a Compare July 16, 2025 06:38
[IMP] Estate : Module with security and basic views

- Added relational fields (many2one, one2many, many2many) to link properties, 
users, and offers.
- Introduced computed and stored fields with dependencies for automatic data 
updates (e.g., total area, best offer).
- Implemented onchange methods for dynamic form updates and improved user 
experience.
- Added server actions to extend business logic and automate workflows.
- Improves data integrity, modularity, and aligns with Odoo’s reactive design 
principles.
[IMP] Estate : Module with security and basic views

-Added relational fields (many2one, one2many, many2many) to link properties, 
users, and offers.
-Introduced computed and stored fields with @api.depends for automatic updates 
(e.g., total area, best offer).
-Implemented onchange methods for dynamic form updates and improved user
 experience.
-Added server actions to support automated workflows and extended business
 logic.
-Strengthens data integrity and aligns with Odoo’s modular, reactive design
 principles.
Added SQL constraints to ensure:
Property expected price is strictly positive
Property selling price is positive
Offer price is strictly positive
Property tag name and property type name are unique
Added Python constraint to prevent selling price from being set
below 90% of expected price

Changes in UI:
Added inline list view for properties on property type form
Used statusbar widget for property state display
Defined default ordering for models and enabled manual ordering for property 
types via sequence field
Applied widget options to restrict creation/editing of property types from 
property form
- Added model and view inheritance for extending existing functionality.
- Implemented interaction with external modules using dependencies.
- Updated estate module to demonstrate cross-module field access and method calls.
- Implemented cross-module field access and method calls to demonstrate 
interaction with other modules.
- Cleaned codebase to fix linter errors and improve readability.
- Added new module estate_account
- Implemented cross-module field access and method calls to demonstrate 
interaction with other modules.
- Cleaned codebase to fix linter errors and improve readability.
- Added demo data and security data to the estate module.
- Implemented record rules and access rights to restrict data access based on 
user groups.
- Updated __manifest__.py to load new data files.
- Corrected linter issues and applied changes based on code review feedback.
-Created a PDF report for estate properties listing all property offers using
QWeb templates and report actions.
-Extended the report in estate_account to include invoice details for sold
properties.
-Organized templates and report actions within their respective modules.
-Updated manifest files to register new reports.
-Enhances reporting by allowing users to generate comprehensive property and
financial documents from the UI.
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from f32463a to 5fb5928 Compare July 16, 2025 06:48
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.

The previous comments are not applied.
The PR still contains a lot of unnecessary diffs and missing has a lot of linting issue.
Some file names are not following proper guidlines.
EOF line missing in a lot of files

Please Update the PR so that it can be further reviews

@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch 3 times, most recently from 6054f0d to dc39666 Compare July 17, 2025 10:47
- Introduced new unit tests in the estate module covering key business processes:
- Prevent offer creation on sold properties.
- Disallow marking properties as sold without an accepted offer.
- Ensure garden area and orientation fields reset appropriately when garden is
unchecked.
-Fix linter issues and apply code review suggestions.
- These tests improve the reliability and maintainability of the estate workflow.
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from dc39666 to 6792087 Compare July 17, 2025 12:01
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.

The Previous changes are still not resolved.
Please adapt the PR accordingly...

Comment on lines +10 to +12
sequence = fields.Integer(
"Sequence", default=10, help="Used to order property types."
)

Choose a reason for hiding this comment

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

What's the use of this sequence ?

Copy link
Author

Choose a reason for hiding this comment

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

It was mentioned in the exercise to add it, so I assumed it might be useful in a later exercise.

from odoo import models, fields


class InheritedResUsers(models.Model):

Choose a reason for hiding this comment

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

Call name does not follow coding guildlines

<div class="page">
<h1>
<span t-field="property.name"/>
</h1 >

Choose a reason for hiding this comment

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

Suggested change
</h1 >
</h1>

<field name="name">estate.property.form</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<form string="Name">

Choose a reason for hiding this comment

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

Give a proper specific name

</page>
<page string="Offers">
<field name="offer_id" readonly="state in ('offer_accepted', 'sold', 'cancelled')">
<list editable="bottom" decoration-danger="status == 'refused'" decoration-success="status == 'accepted'"> <!-- editable="bottom" for edit without opening form-->

Choose a reason for hiding this comment

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

Remove the commented line if not needed

offer.property_id.selling_price = offer.price
offer.status = "accepted"
offer.property_id.state = "offer_accepted"
# Setting remaining Offer as refused

Choose a reason for hiding this comment

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

not needed

offer.property_id.selling_price = offer.price
offer.status = "accepted"
offer.property_id.state = "offer_accepted"
# Setting remaining Offer as refused

Choose a reason for hiding this comment

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

not needed

"name": "Estate Account",
"summary": "Integrate real estate operations with accounting",
"description": "Extends the Real Estate app to handle financial operations. Automates invoicing, tracks commissions, and links property sales with accounting workflows for seamless integration",
"depends": ["base", "estate", "account"],

Choose a reason for hiding this comment

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

One of the dependency estate have base already in its own dependency, so why do we need this explicitly here ?

Copy link
Author

Choose a reason for hiding this comment

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

Actually, I was aware that one of its dependencies includes base, but I didn’t realize we don’t need to declare it again in such cases. I’ll update it accordingly. Thanks for letting me know.

"installable": True,
"depends": ["base"],
"application": True,
"license": "AGPL-3",

Choose a reason for hiding this comment

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

why not LGPL-3 ?

Copy link
Author

Choose a reason for hiding this comment

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

I took reference from one of the existing modules and didn’t realize I should be using LGPL-3 here. I understand now that AGPL-3 requires sharing all changes, while LGPL-3 allows more flexibility for private use. I’ll update the license.

"depends": ["base", "estate", "account"],
"category": "Tutorials",
"installable": True,
"license": "AGPL-3",

Choose a reason for hiding this comment

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

Why not LGPL-3 ?

@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from 5af7436 to 7ffe14f Compare July 18, 2025 17:05
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from 7ffe14f to 75c8658 Compare July 18, 2025 17:11
…utorial

Introduce initial Owl components as part of the JavaScript framework learning
exercise.
Includes examples of reactive state, component composition, prop passing,
 template rendering, and event handling using Owl.
@rvar-odoo rvar-odoo force-pushed the 18.0-training-rvar branch from 75c8658 to 5518b4e Compare July 18, 2025 17:17
- Developed a custom dashboard module utilizing OWL and JavaScript to present
important business metrics in a visually appealing and interactive interface.
- The dashboard pulls real-time data from backend models, displaying it through
summary cards and various charts.
- This module serves as a practical example of constructing responsive dashboard
in Odoo with client-side rendering and tailor-made components
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