-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[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
base: 18.0
Are you sure you want to change the base?
Conversation
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.
93657db
to
b6e2c1e
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.
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 |
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.
Missing licensing
estate/__manifest__.py
Outdated
"installable": True, | ||
"depends": ["base"], | ||
"application": True, | ||
"auto_install": False, |
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 the value is false, then no need to define it anyways
estate/__manifest__.py
Outdated
"summary": "Demo app for estate", | ||
"description": "This is the demo app ", |
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.
Add a proper summary and description
estate/models/estate_property.py
Outdated
class RecurringPlan(models.Model): | ||
_name = "estate.property" | ||
_description = "estate property revenue plans" |
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.
Mismatch class name and model name
estate/models/estate_property.py
Outdated
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"> |
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.
Comment is not required here
# 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 |
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.
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}] |
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.
Unnecessary
estate/security/ir.model.access.csv
Outdated
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 |
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.
End of file line is missing
estate/views/res_users_views.xml
Outdated
</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.
End of file line is missing
journal = self.env["account.journal"].search( | ||
[("type", "=", "sale")], limit=1 | ||
) |
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 you think searching inside for loop is efficient way to do it ?
454d05d
to
127ad83
Compare
-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.
127ad83
to
f32463a
Compare
[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.
f32463a
to
5fb5928
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.
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
6054f0d
to
dc39666
Compare
- 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.
dc39666
to
6792087
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.
The Previous changes are still not resolved.
Please adapt the PR accordingly...
sequence = fields.Integer( | ||
"Sequence", default=10, help="Used to order property types." | ||
) |
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's the use of this sequence ?
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 was mentioned in the exercise to add it, so I assumed it might be useful in a later exercise.
estate/models/inherited_res_users.py
Outdated
from odoo import models, fields | ||
|
||
|
||
class InheritedResUsers(models.Model): |
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.
Call name does not follow coding guildlines
<div class="page"> | ||
<h1> | ||
<span t-field="property.name"/> | ||
</h1 > |
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.
</h1 > | |
</h1> |
<field name="name">estate.property.form</field> | ||
<field name="model">estate.property</field> | ||
<field name="arch" type="xml"> | ||
<form string="Name"> |
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.
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--> |
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.
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 |
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.
not needed
offer.property_id.selling_price = offer.price | ||
offer.status = "accepted" | ||
offer.property_id.state = "offer_accepted" | ||
# Setting remaining Offer as refused |
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.
not needed
estate_account/__manifest__.py
Outdated
"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"], |
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.
One of the dependency estate
have base
already in its own dependency, so why do we need this explicitly here ?
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.
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.
estate/__manifest__.py
Outdated
"installable": True, | ||
"depends": ["base"], | ||
"application": True, | ||
"license": "AGPL-3", |
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.
why not LGPL-3
?
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.
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.
estate_account/__manifest__.py
Outdated
"depends": ["base", "estate", "account"], | ||
"category": "Tutorials", | ||
"installable": True, | ||
"license": "AGPL-3", |
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.
Why not LGPL-3
?
5af7436
to
7ffe14f
Compare
7ffe14f
to
75c8658
Compare
…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.
75c8658
to
5518b4e
Compare
- 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
*=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.