Skip to content

[ADD] estate: add real estate advertisement module#1230

Draft
vikvi-odoo wants to merge 15 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-vikvi
Draft

[ADD] estate: add real estate advertisement module#1230
vikvi-odoo wants to merge 15 commits intoodoo:19.0from
odoo-dev:19.0-tutorial-vikvi

Conversation

@vikvi-odoo
Copy link
Copy Markdown

@vikvi-odoo vikvi-odoo commented Apr 6, 2026

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

@robodoo
Copy link
Copy Markdown

robodoo commented Apr 6, 2026

Pull request status dashboard

@vikvi-odoo vikvi-odoo requested review from mash-odoo and removed request for mash-odoo April 6, 2026 04:30
@vikvi-odoo vikvi-odoo force-pushed the 19.0-tutorial-vikvi branch from c610728 to cdb5287 Compare April 6, 2026 12:46
@vikvi-odoo vikvi-odoo changed the title Add chapter 4 [ADD] estate: add real estate advertisement module Apr 8, 2026
@mash-odoo mash-odoo removed their request for review April 8, 2026 06:23
Copy link
Copy Markdown

@bit-odoo bit-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 @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

Comment thread estate/models/estate_property.py
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/security/ir.txt Outdated
Comment thread estate/views/estate_menus.xml Outdated
Comment thread estate/views/estate_menus.xml Outdated
Comment thread estate/views/estate_property_views.xml Outdated
- 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.
@vikvi-odoo vikvi-odoo force-pushed the 19.0-tutorial-vikvi branch from 79e4560 to e80d110 Compare April 9, 2026 04:40
- 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.
Implement Many2one, Many2many, and One2many relationships:
- Add Many2one link from property to property type
- Add Many2many link between property and property tags
- Add One2many link from property to offers
- Update views to display the new relational fields
- The estate module's manifest was updated to include a proper description.
- A standard LICENSE  has been added .
- These additions ensure the module is complete and adheres to standard Odoo module structure.
- Implement action_sold_property and action_cancel_property buttons.
- Add validation to prevent cancelling a sold property and vice-versa.
- Add action_accept_offer and action_reject_offer buttons in offer list.
- Implement logic to automatically set selling_price and buyer upon offer acceptance.
- Add UserError constraints to ensure data integrity during state transitions.
…t view

- Add 'title' attribute to Accept and Reject buttons in the offer list view.
- Resolve view validation error: "A button with icon attribute must have title".
… 10)

- Add SQL constraints to ensure expected_price and offer price are strictly positive.
- Add unique SQL constraints for property type and tag names to prevent duplicates.
- Implement Python @api.constrains to enforce the "90% Rule": selling price
  cannot be lower than 90% of the expected price.
- Use float_compare and float_is_zero tools for robust numerical validation.
-Clean up estate_property_offer.py by removing the ValidationError import which is no longer utilized in the current implementation.
@vikvi-odoo vikvi-odoo requested a review from bit-odoo April 22, 2026 13:25
Copy link
Copy Markdown

@bit-odoo bit-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,
I have added some comments.
Your code is not aligned with coding guidelines.
Please refer to the coding guidelines documentation.
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html

Also, can you please update your PR description, as it should be generic.

Thanks

('south', 'South'),
('east', 'East'),
('west', 'West'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unneccary empty line.

buyer = fields.Many2one('res.partner', copy=False)
offer_ids = fields.One2many('estate.property.offer', 'property_id')
active = fields.Boolean()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unneccary empty line.

offer_ids = fields.One2many('estate.property.offer', 'property_id')
active = fields.Boolean()

total = fields.Integer(compute='_compute_totalArea')
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
total = fields.Integer(compute='_compute_totalArea')
total_area = fields.Integer(compute='_compute_total_area')

Comment on lines +51 to +93
@api.depends('living_area', 'garden_area')
def _compute_totalArea(self):
for record in self:
record.total = record.garden_area + record.living_area

@api.depends('offer_ids.price')
def _compute_best_price(self):
for record in self:
prices = record.offer_ids.mapped('price')

if prices:
record.best_price = max(prices)
else:
record.best_price = 0

@api.onchange('garden')
def _onchange_garden(self):
if self.garden:
self.garden_area = 10
self.garden_orientation = "north"
else:
self.garden_area = 0
self.garden_orientation = ""

def action_sold_property(self):
if self.state == 'cancelled':
raise UserError("A cancelled property cannot be set as sold.")
return False

self.state = 'sold'
return True

def action_cancel_property(self):
if self.state == 'sold':
raise UserError("A sold property cannot be set as cancelled.")

self.state = 'cancelled'
return True

_check_positive = models.Constraint(
'check(expected_price > 0 )',
'Expected price must be positive'
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if record.status == 'accepted':
raise UserError('Offer is already accepted')
return 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.

unneccary empty line.

Comment on lines +49 to +54
if self.status == 'accepted':
self.status = 'refused'
self.property_id.selling_price = 0
self.property_id.buyer = ""
else:
raise UserError('The offer you are refusing is not the accepted one')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you add a check that to refuse the offer, we have to first accept it?


def action_cancel_property(self):
if self.state == 'sold':
raise UserError("A sold property cannot be set as cancelled.")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is good if we make the error message translatable.
raise UserError(_("A sold property cannot be set as cancelled."))

class EstatePropertyTag(models.Model):
_name = "estate.property.tag"
_description = "Estate Property Tag"
name = fields.Char(required=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.

should be one line empty before it.

Comment thread estate/git
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

unneccary file change.

</list>
</field>
</record>
<record id="estate_property_form" model="ir.ui.view">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should be one empty line before it. You can refer to the coding guidelines documentation.
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#xml-files

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