[ADD] estate: add real estate advertisement module#1230
[ADD] estate: add real estate advertisement module#1230vikvi-odoo wants to merge 9 commits intoodoo:19.0from
Conversation
c610728 to
cdb5287
Compare
bit-odoo
left a comment
There was a problem hiding this comment.
Hello @vikvi-odoo
You have written too many comments in the code.
Writing a comment is good, but no need to write a comments onevery single line. It's only required, like when there is a complex computation, etc.
Please use ruff for proper formatting.
Thanks
| from odoo import fields, models | ||
| from odoo.tools import date_utils | ||
|
|
||
| class EstateProperty(models.Model): |
There was a problem hiding this comment.
should be two empty lines before class starts.
estate/models/estate_property.py
Outdated
| _name = "estate.property" | ||
| _description = "Estate Property for purchasing and selling properties" | ||
|
|
||
| # _log_access = False # this will disable the automatic creation of create_uid,create_date,write_uid,write_date fields in our table. these fields are used to track who created and modified the record and when it was done. |
There was a problem hiding this comment.
I don't think it is required. As you didn't use _log_access here.
estate/models/estate_property.py
Outdated
| # module: a module is a package of features/functionality in odoo.Ex : CRM,Sales,EstateProperty.it's a complete feature bundle | ||
| # model : model is a python class that define data structure and logic.it represent a real world entity | ||
| # table: a table is the actual data stored in database.our _name = "estate.property" will converted to estate_property table name | ||
| # relationship : module -> model -> table | ||
|
|
||
| # Odoo's ORM calls `_auto_init()` on your model, which introspects all fields and runs `CREATE TABLE` / `ALTER TABLE`. Here's roughly what happens: | ||
| # ``` | ||
| # _name = "estate.property" => estate is a module name and property is a model name this tells that "property" belongs to estate module. giving name like using dot (estate.property) is a odoo convention | ||
| # table name = "estate_property" | ||
| # The _ prefix tells Odoo "this is configuration about the model itself", not "this is a field to store in the database". | ||
|
|
||
|
|
||
| #what is happening in backend? how odoo is connecting to psql even if we are not adding code to connect it? | ||
| #=>when odoo load's our model it convert out table name estate.property to estate_property | ||
| #=> Odoo's base Model class (which your class inherits from) has a method called _auto_init(). This runs automatically during module install/upgrade. | ||
| #=> inside auto_init method there is self._cr, it's a database cursor this is the actual live connection to postgresql.it send the connection request to psycopg2 py library and this library establish the connection to psql |
estate/security/ir.txt
Outdated
| ir.model.access.csv file control the access of our model through odoo. | ||
|
|
||
| User clicks "Create Property" in Odoo UI | ||
| ↓ | ||
| Odoo checks ir.model.access.csv | ||
| ↓ | ||
| is this user's group allowed to create? | ||
| ↓ | ||
| YES → ORM fires SQL to PostgreSQL | ||
| NO → "Access Denied" error shown to user | ||
| PostgreSQL never even gets the request |
estate/views/estate_menus.xml
Outdated
| @@ -0,0 +1,12 @@ | |||
| <?xml version="1.0" encoding="UTF-8" ?> | |||
| <odoo> <!--<odoo> tells odoo this is a data file.everything inside is odoo records.without this odoo will not load the data and give the error--> | |||
There was a problem hiding this comment.
Writing a comment is good, but no need to write a comment here. It's only required when there is complex computation, etc.
estate/views/estate_menus.xml
Outdated
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <odoo> <!--<odoo> tells odoo this is a data file.everything inside is odoo records.without this odoo will not load the data and give the error--> | ||
| <menuitem id="estate_root_menu" name="Real Estate" > <!--this is root menu--> | ||
| <menuitem id="estate_first_level_menu" name="Advertisements"> <!--this is first level menu.this create another record in ir_model_data table and it's nestead so odoo automatically set parent as estate_root_menu's db id--> |
There was a problem hiding this comment.
Writing a comment is good, but no need to write a comment here. It's only required when there is complex computation, etc.
| <record id="estate_property_action" model="ir.actions.act_window"> | ||
| <field name="name">Estate Property</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> |
- Create the initial __manifest__.py file to define the module's metadata and make it discoverable by Odoo. - Add the __init__.py file to mark the directory as a Python package and prepare for importing future models and other components. - Establish the basic structure required for the new 'estate' module to be loaded and function within the Odoo framework.
- Updated the commit message to accurately reflect the changes made in the estate module for Chapter 2.
- fix the space issue in the __init__.py file of the estate module to ensure proper formatting and readability.
- Created estate.property model - Added module structure and manifest configuration - Implemented fields and basic validations - Fixed import and dependency issues - Resolved runtime errors during module loading [fix] estate: fix issue of external id and access rights [fix] estate: fix issue of access rights for estate.property model [fix] estate: fix issue of installation of estate module due to missing access rights
- Added ir.model.access.csv for estate.property - Configured basic CRUD permissions for internal users Chapter 4 - Security Intro
- Introduce the estate module into the user interface. - Add estate_menus.xml to define the module's menu structure and make it visible. - Include estate_property_views.xml to define the initial property views. - Implement the necessary extra fields and conditions as required by chapter 5.
- Removed superfluous comments that added noise without providing value. - Addressed inconsistent indentation to ensure adherence to code style guidelines.
- Addressed inconsistent indentation to ensure adherence to code style guidelines.
79e4560 to
e80d110
Compare
- Implement the list view for the estate properties. - Implement the form view for detailed property management. - Implement the search view to allow filtering and grouping of properties. - These views are introduced as part of the Chapter 6 exercises in the Odoo development tutorial.

Add a new real estate advertisement module that allows
users to manage property listings. The module includes
the data model, security access rights, and the basic
UI to navigate and interact with property records.
Chapter-2 to Chapter-5