Skip to content

Conversation

@hapat-odoo
Copy link

@hapat-odoo hapat-odoo commented Nov 5, 2025

Created and configured the database for the Real Estate module, defining necessary fields such as property type, tags, buyer, salesperson, and offers. Implemented list, form, and search views with groupings, and added computed fields, inverse functions, and onchange functionalities. Included 'Sold' and 'Cancel' buttons with their corresponding functionality, as well as 'Accept' and 'Refuse' buttons with related logic.

Added a new module for estate property and completed tasks 1, 2, and 3.
 I added a models folder and learned to push data into PostgreSQL using ORM.
Enhanced the Security Logic for improved protection. Added the access control
rights for the estate_property.py file
@robodoo
Copy link

robodoo commented Nov 5, 2025

Pull request status dashboard

Copy link

@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, Good Work!
I have left some comments.

For commit message you can refer this documentation :- https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html#commit-message-full-description

@@ -0,0 +1,40 @@

Copy link

Choose a reason for hiding this comment

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

unnecessary diff.

copy=False,
default='new'
)

No newline at end of file
Copy link

Choose a reason for hiding this comment

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

An empty line should be without whitespace.

name="List"
parent="estate_property_menu"
action="action_estate_property_list_only"/>

Copy link

Choose a reason for hiding this comment

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

unnecessary diff.

Comment on lines 12 to 15
<menuitem id="estate_property_list_menu"
name="List"
parent="estate_property_menu"
action="action_estate_property_list_only"/>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<menuitem id="estate_property_list_menu"
name="List"
parent="estate_property_menu"
action="action_estate_property_list_only"/>
<menuitem id="estate_property_list_menu"
name="List"
parent="estate_property_menu"
action="action_estate_property_list_only"/>

<field name="view_id" ref="estate_property_form_view"/>
</record>


Copy link

Choose a reason for hiding this comment

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

unnecessary diff.

<separator/>
<filter name="group_by_postcode"
string="Group by Postcode"
context="{'group_by': 'postcode'}"/>
Copy link

Choose a reason for hiding this comment

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

Please check indentation.

Comment on lines +5 to +12
<menuitem id="estate_advertisement_menu"
name="Advertisements"
parent="estate_root_menu"/>
<menuitem id="estate_property_menu"
name="Properties"
parent="estate_advertisement_menu"
action="action_estate_property"/>
Copy link

Choose a reason for hiding this comment

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

Same as below.

Copy link

@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 made another round of review
As we discussed early, can you please update your commit message title and please update your PR title and message?

Comment on lines 1 to 2
from odoo import models, fields, api
from datetime import timedelta

Choose a reason for hiding this comment

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

Suggested change
from odoo import models, fields, api
from datetime import timedelta
from datetime import timedelta
from odoo import models, fields, api

("west", "West"),
])
active = fields.Boolean(default=True)

Choose a reason for hiding this comment

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

unnecessary diff.

("sold", "Sold"),
("canceled", "Canceled"),
], string="Status", required=True, copy=False, default="new")

Choose a reason for hiding this comment

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

unnecessary diff.

salesperson_id = fields.Many2one("res.users", string="Salesperson")
tag_ids = fields.Many2many("estate.property.tag", string="Tags")
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")

Choose a reason for hiding this comment

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

Same here.

Comment on lines 119 to 127
_check_expected_price = models.Constraint(
'CHECK(expected_price < 0)',
'The expected price of a property must be strictly positive.'
)

_check_selling_price = models.Constraint(
'CHECK(selling_price < 0)',
'The selling price of a property must be positive.'
)

Choose a reason for hiding this comment

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

Constraints should be defined after the field declaration. And is this your condition going to work properly ?. Have you checked it?

Comment on lines 42 to 48
<header>
<button name="action_set_next_status" string="Next" type="object"/>
<button name="action_back_to_new" string="Reset to New" type="object"/>
<button name="action_set_sold" string="Mark as Sold" type="object"/>
<button name="action_set_canceled" string="Cancel" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="new,offer_received,offer_accepted,sold,canceled"/>
</header>

Choose a reason for hiding this comment

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

should be outside of the sheet for better visibility. You can take reference from other Odoo apps.

if record.selling_price < 0.9 * record.expected_price:
raise ValidationError("Selling price must be at least 90% of the expected price")
if record.expected_price < 0:
raise ValidationError("Expected price must be greater than 0")

Choose a reason for hiding this comment

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

We already have constrain, so do we need it here?

_check_type_name_unique_ratio = models.Constraint(
'CHECK(name)',
'The property name must be unique.'
) No newline at end of file

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 at the end of the file.

Copy link

@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 think you have to adapt the changes that i suggest you. I have to make comment multiple times it is not good.

garden_area = fields.Integer()
garden_orientation = fields.Selection([("north", "North"),("south", "South"),("east", "East"),("west", "West"),])
active = fields.Boolean(default=True)
state = fields.Selection([("new", "New"),("offer_received", "Offer Received"),("offer_accepted", "Offer Accepted"),("sold", "Sold"),("canceled", "Canceled")], required=True, copy=False , )

Choose a reason for hiding this comment

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

Suggested change
state = fields.Selection([("new", "New"),("offer_received", "Offer Received"),("offer_accepted", "Offer Accepted"),("sold", "Sold"),("canceled", "Canceled")], required=True, copy=False , )
state = fields.Selection(
[
("new", "New"),
("offer_received", "Offer Received"),
("offer_accepted", "Offer Accepted"),
("sold", "Sold"),
("canceled", "Canceled")
], required=True, copy=False)

For better readability.

total_area = fields.Float(compute="_compute_total_area", string="Total Area", store=True)
best_price = fields.Float(compute="_compute_best_price", string="Best Offer", store=True)
validity_days = fields.Integer(default=7)
date_deadline = fields.Date(compute="_compute_date_deadline",inverse="_inverse_date_deadline",store=True,)

Choose a reason for hiding this comment

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

Suggested change
date_deadline = fields.Date(compute="_compute_date_deadline",inverse="_inverse_date_deadline",store=True,)
date_deadline = fields.Date(compute="_compute_date_deadline", inverse="_inverse_date_deadline", store=True,)

_check_price = models.Constraint(
'CHECK(expected_price > 0 AND selling_price >= 0)',
'The expected price of a property must be strictly positive.'
) No newline at end of file

Choose a reason for hiding this comment

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

EOL missing.

<field name="arch" type="xml">
<form string="Property">
<header>
<button name="action_set_next_status" string="Next" type="object"/>

Choose a reason for hiding this comment

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

I do not think that this button is necessary. As a user can not change the state manually every time.

raise ValidationError("You cannot delete a new or canceled property.")
return super().unlink()

_check_price = models.Constraint(

Choose a reason for hiding this comment

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

It should be after field declaration, as I mentioned in the earlier comment.

'CHECK(name)',
'The property name must be unique.'
)

No newline at end of file

Choose a reason for hiding this comment

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

EOL missing.

</form>
</field>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

EOL missing.

</record>


</odoo> No newline at end of file

Choose a reason for hiding this comment

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

EOL missing.

<field name="view_mode">form</field>
<field name="view_id" ref="view_users_form_inherit_properties"/>
</record>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

EOL missing.

Introduced a new menu structure for the estate module, including a root menu and submenus for properties. Also added an action for managing estate properties with a corresponding view mode.
@hapat-odoo hapat-odoo changed the title 19.0 tutorial hapat [ADD] estate: created a new module Nov 14, 2025
-added  search view state field and list and form views

[IMP] estate:  Added list & form view

-added  filter for new or offer received stage

[IMP] estate:  Implemented models and views for property offers

-added  models and views for property offers field
… and types

Implemented models and views for property offers
tags and types
Enhanced property model and views with new fields and improved form layout
 Implemented offer acceptance and refusal actions;
added state management buttons in property views

[FIX] estate: resolve Runbot style and linting errors (Ruff/Semgrep)

This commit fixes all Runbot Check Style issues for the estate module.

[FIX] estate: Cleaned up code by removing unnecessary blank lines in model files
-Refactored validity field to validity_days
-added constraints for price validation
-Implemented inline views and widgets to enhance the user interface within the
Real Estate module.
-Introduced list-ordering functionality to improve the organization and sorting
of listings.
-Added attribute and option configurations to increase customization capabilities
and overall flexibility for users.
-implemented inheritance in models,views
-implemented some ui changes
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