Skip to content

[ADD] estate: Added the new real estate module#1228

Draft
ripil-odoo wants to merge 13 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-training-ripil
Draft

[ADD] estate: Added the new real estate module#1228
ripil-odoo wants to merge 13 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-training-ripil

Conversation

@ripil-odoo
Copy link
Copy Markdown

Created a new folder called 'estate' with 'init.py' (empty) and 'manifest.py'. Ensured the app is listed in the Apps module, the only dependency added was 'base'.

Chapter 2

Created a new folder called 'estate' with '__init__.py' (empty) and '__manifest__.py'.
Ensured the app is listed in the Apps module, the only dependency added was 'base'.

Chapter 2
Removed the unnecessary encoding declaration and removed trailing whitespaces from multiple lines in the '__manifest__.py' file. Also, added the missing extra line in the end of the code file

Chapter 2
Created the estate_properties model with simple fields for name, description, date_availability, etc. Understood imports, models, and fields.

Chapter 3
Created the security folder inside the estate module with the csv file giving read, write, create and unlink access to the group 'base.group_user' and ensured the no access rights warning doesn't show up in the server startup logs.

Chapter 4
@robodoo
Copy link
Copy Markdown

robodoo commented Apr 3, 2026

Pull request status dashboard

@ripil-odoo ripil-odoo requested a review from mash-odoo April 3, 2026 12:48
Removed the trailing whitespaces and extra lines from multiple files.

Chapter 4
Created an action for the model estate.properties as well as the estate_properties_view.xml in the views folder. Created three levels of menus for the action in the file estate_menus.xml.
Defined both in proper sequential order in the estate manifest as well.

Chapter 5
Calculated the date with 3 month addition for the date_availability field dynamically.

Chapter 5
Created the custom view for estate module list view and code space formatting in estate_properties.py file.

Chapter 6
Added all the required fields in the list view as specified in the task along with changed labels and width. Created user access to not have create permissions.

Chapter 6
Created custom fields for form view in groups and notebook.

Chapter 6
Copy link
Copy Markdown

@mash-odoo mash-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!
Thank you for your work.
Here are some few questions and suggestions.

Comment on lines +1 to +4
from odoo import models, fields
import logging
# from datetime import date, timedelta
from dateutil import relativedelta as rd
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please refer to this for sorting imports properly

Comment on lines +16 to +17
_name = "estate.properties"
_description = "Real Estate Properties"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The technical strings should be written with single quotes and the user defined strings which would be visible on UI should be with double quotes

Suggested change
_name = "estate.properties"
_description = "Real Estate Properties"
_name = 'estate.properties'
_description = "Real Estate Properties"

Comment on lines +20 to +21
description = fields.Text('Description', help="Description of the property shown")
postcode = fields.Char('Postcode', help="Postal Code of the property shown")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
description = fields.Text('Description', help="Description of the property shown")
postcode = fields.Char('Postcode', help="Postal Code of the property shown")
description = fields.Text(help="Description of the property shown")
postcode = fields.Char(help="Postal Code of the property shown")

You don't need to write the string if you want it to be displayed same as the field name.
Also its good to write help, but try writing it only when the field is a bit complex to understand

garage = fields.Boolean('Has Garage?', help="Does the proeprty have a garage?")
garden = fields.Boolean('Has Garden?', help="Does the property have a garden?")
garden_area = fields.Integer('Garden Area', help="Area of the garden of the property shown")
garden_orientation = fields.Selection([('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], help="Directional orientation of the garden of the property shown")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Try breaking the line and make it <100 chars per line so that it can be easier to read.

Suggested change
garden_orientation = fields.Selection([('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')], help="Directional orientation of the garden of the property shown")
garden_orientation = fields.Selection(
[
('north', "North"),
('south', "South"),
('east', "East"),
('west', "West")
],
help="Directional orientation of the garden of the property shown"
)

Also try writing the values in double quotes as it will be displayed to the user

date_availability = fields.Date('Availability Date', help="Date of availability of the property shown", copy=False, default=lambda self: _logger.info("!!! date time calculated at creation") or fields.Date.add(fields.Date.context_today(self), months=3))
_logger.info("Date set? %s", date_availability)
expected_price = fields.Float('Expected Price', required=True, help="Expected price of the property shown")
selling_price = fields.Float('Selling Price', help="Selling Price of the property shown", readonly=True, copy=False)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the purpose of using copy=False?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

copy=False allows the field to not be copied when it is duplicated, it is true by default

</form>
</field>
</record>
<record id="estate_action" model="ir.actions.act_window">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<record id="estate_action" model="ir.actions.act_window">
<record id="estate_properties_action" model="ir.actions.act_window">

Comment on lines +15 to +16
'installable': True,
'application': True,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the purpose of using 'application': True and 'installable': True?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

  1. 'application': True makes the estate module list as an app and visible with the Apps filter, otherwise it is not listed as an app just a module
  2. 'installable': True allows the module to be installed ('Activate' button)

description = fields.Text('Description', help="Description of the property shown")
postcode = fields.Char('Postcode', help="Postal Code of the property shown")
date_availability = fields.Date('Availability Date', help="Date of availability of the property shown", copy=False, default=lambda self: _logger.info("!!! date time calculated at creation") or fields.Date.add(fields.Date.context_today(self), months=3))
_logger.info("Date set? %s", date_availability)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is logger used for?

Copy link
Copy Markdown
Author

@ripil-odoo ripil-odoo Apr 9, 2026

Choose a reason for hiding this comment

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

It helps to debug and understand the flow, here I used it to see when the function was called and to see what the field was

Comment on lines +2 to +3
access_estate_user,access_estate_user,model_estate_properties,base.group_user,1,0,0,0
access_estate_admin,access_estate_user,model_estate_properties,base.group_system,1,1,1,1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you explain me what happens when you write these lines?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These lines give access rights to two groups: group_user (internal) and group_system (admin). Without access rights there is no rights to anyone. The permissions are to read, write, create, unlink.

name = fields.Char('Property Name', required=True, help="Name of the property shown")
description = fields.Text('Description', help="Description of the property shown")
postcode = fields.Char('Postcode', help="Postal Code of the property shown")
date_availability = fields.Date('Availability Date', help="Date of availability of the property shown", copy=False, default=lambda self: _logger.info("!!! date time calculated at creation") or fields.Date.add(fields.Date.context_today(self), months=3))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is not a correct way to use a logger inside of a default. Use _logger for debugging flows (create, write or any other functions) pr to track important changes. Avoid using it in fields or lambdas.

Finished adding custom fields for the form view. Created a custom search view without filters using only fields. Addressed all the comments from the PR and fixed the code formatting issues.

Chapter 5, 6
Fixed whitespace issue in the file 'estate_properties.py' and removed unnecessary testing code from the custom views.

Chapter 6
…odule

Creating custom filters in the search view using search domain and context, used logical filters for fields from the estate properties model.

Chapter 6
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