Skip to content

[ADD] real_estate,* : Full Implementation with ORM, Access Control and Accounting Integration #838

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

Conversation

prbo-odoo
Copy link

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

*= estate_account

This pull request includes the complete setup of the Real Estate module based on the first 13 chapters of the Odoo 18.0 Developer Tutorial. The aim was to build a production-ready module by applying all key concepts from the tutorial in one working project that covers model design, view customization, user access control and business automation.

I added relational fields like Many2one, One2many and Many2many for properties, offers, tags and property types. Business logic like accepting/rejecting offers, checking constraints and handling different property states (like new, sold, canceled) was implemented to make the module behave like a real-world system.

To make the module secure, I applied access controls so that only specific users can view or change certain data. I also created custom views like List, Form and Search so users can easily interact with the system. Invoices are automatically created when a property is sold, by connecting this module with the Accounting module.

To connect with the Accounting module, automatic invoice creation was added when a property is sold. This demonstrates integration between custom apps and core Odoo modules.

I followed Odoo’s best practices to keep the code clean and scalable. I used Odoo’s ORM methods (create, write) and also made sure performance is good when dealing with multiple records using the @api.model_create_multi decorator and proper use of browse().Clear error messages (UserError, ValidationError) were implemented for better user feedback.

I tested each flow manually: creating offers, rejecting invalid ones, changing states correctly, checking user access and making sure the invoice is generated after a sale.

As a result, the module now works smoothly like a real property management system. It is clean and easy to use.

@robodoo
Copy link

robodoo commented Jul 9, 2025

Pull request status dashboard

@prbo-odoo prbo-odoo force-pushed the 18.0-training-prbo branch 3 times, most recently from 871bd93 to 15d69d2 Compare July 9, 2025 07:06
prbo-odoo added 4 commits July 9, 2025 12:43
This commit covers Chapters 4, 5, and 6 of the server framework tutorial. It
includes:

- Adding security access rules for the basic model to manage user permissions.
- Creating the first user interface by adding a menu item and action to navigate
to the model records.
- Defining the basic tree (list) view and form view for the model to enable
record visualization and editing.
…properties

This commit introduces action buttons to accept or refuse offers in the
real_estate module. When an offer is accepted, the property’s selling price,
buyer, and state are updated accordingly. Other offers are automatically refused
to ensure only one offer is accepted per property.

Also added:
- 'state' field on properties to manage lifecycle (new, offer_received, sold,
cancelled)
- Computed best price field from offers
- Validity-based deadline logic using compute/inverse methods on offers
- Safeguards preventing sale of cancelled properties and cancellation of sold
ones
…ty models

This commit adds data integrity and UI improvements as guided by Chapters 10 and
11 of the Odoo Server Framework 101 tutorial.

Constraints:
- Added SQL constraints to ensure unique names for property types and tags.
- Added SQL constraint to ensure color index stays within valid range.
- Implemented Python constraints to enforce logical business rules

UI Enhancements:
- Introduced computed field  on property types.
- Added stat button to open related offers via domain.
- Enhanced form views with notebooks and inline editing for better UX.
- Updated navigation menu to include property type and tag settings.
@prbo-odoo prbo-odoo force-pushed the 18.0-training-prbo branch 6 times, most recently from ac4126a to f4fbabf Compare July 9, 2025 08:46
…rnal module

Extended the  model in the  module using model
inheritance. This extension adds new accounting-related fields and functionality
that align with the tutorial’s objective of building on top of existing models.

Additionally, reused features from another module (), demonstrating how
to extend and interact with models defined externally. This helps in separating
concerns and encourages modular design by keeping accounting logic in a separate
module.

Reasons for the change:
- To demonstrate how to extend existing models via , promoting reuse
of logic.
- To maintain separation of concerns by creating a dedicated accounting module
for estate management.
- To align with Odoo framework best practices, particularly regarding
modularization and cross-module integration.
- To enhance maintainability and scalability of the estate management
application.
@prbo-odoo prbo-odoo force-pushed the 18.0-training-prbo branch from f4fbabf to c63782b Compare July 9, 2025 08:57
@prbo-odoo prbo-odoo marked this pull request as draft July 9, 2025 08:59
Refactored backend code to align with Odoo coding guidelines and updated
security declarations per Odoo 18.0 standards.

-Applied proper access control in security XML files
-Updated Python and XML code formatting to follow coding conventions
-Removed unused imports and improved variable naming
-Ensured model access rights are correctly defined
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.

First pass ......🚀

The PR message is not appropriate and it need adaptation.
Also there are a lot of unnecessary lines left for no reason, please adapt it.

@prbo-odoo prbo-odoo changed the title 18.0 training prbo [ADD] real_estate,* : Full Implementation with ORM, Access Control and Accounting Integration Jul 11, 2025
Improved the real_estate module by applying proper data access restrictions
using record rules and security groups to ensure users only see permitted
records based on their roles.

Enhanced the real_estate module by restricting data access using security groups
and record rules to ensure users only view or modify records they are permitted
to.

Defined essential module data such as user roles, property types and permissions
using XML files to enable consistent setup during module installation.

These updates improve the module’s security and prepare it for scalable, role-
based.
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