Skip to content

[ADD] module: add new module real estate (Onboarding)#1238

Open
yogietama wants to merge 14 commits intoodoo:19.0from
odoo-dev:19.0-onboarding-yomet
Open

[ADD] module: add new module real estate (Onboarding)#1238
yogietama wants to merge 14 commits intoodoo:19.0from
odoo-dev:19.0-onboarding-yomet

Conversation

@yogietama
Copy link
Copy Markdown

Create Real Estate Module for onboarding program

@robodoo
Copy link
Copy Markdown

robodoo commented Apr 21, 2026

Pull request status dashboard

@yogietama yogietama requested a review from delcourtfl April 21, 2026 15:16
@yogietama yogietama force-pushed the 19.0-onboarding-yomet branch from 2dd0080 to 5d0a3ce Compare April 22, 2026 08:23
@yogietama yogietama force-pushed the 19.0-onboarding-yomet branch from 5d0a3ce to aeda88e Compare April 22, 2026 08:37
Comment thread estate/__manifest__.py Outdated
Comment thread estate/models/__init__.py Outdated
Comment thread estate/__manifest__.py Outdated
Comment thread estate/__manifest__.py Outdated
Comment thread estate/views/estate_property_views.xml Outdated
Comment thread estate/views/estate_property_views.xml Outdated
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/__manifest__.py Outdated
@delcourtfl
Copy link
Copy Markdown

Hello there ! Good work already, just added a few comments.

Also it seems your first commit has the wrong author set (most probably because your config was not properly set before pushing, might want to check into this as a general git exercise)

Copy link
Copy Markdown

@delcourtfl delcourtfl left a comment

Choose a reason for hiding this comment

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

Hello there ! Good work already, just a few comments.

(Might also need to check runbot style CI for some additional issues)

Comment on lines +11 to +14
_check_expected_price = models.Constraint(
'CHECK(expected_price > 0)',
'The expected price must be strictly 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.

Always try to keep the fields declaration before the constraints (see https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#symbols-and-conventions for the model attribute order)

Comment thread estate/models/estate_property.py Outdated
# if offer percentage lower then 90%
if float_compare(offer_percentage,
0.9, precision_digits=2) == -1:
raise ValidationError(f"{m1}. {m2}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I believe it's better to keep the error message in the error call (or just beside it, unless it repeats) to avoid having to look back and forth in the code to understand the issue.

Suggested change
raise ValidationError(f"{m1}. {m2}")
raise ValidationError(
"The selling price cannot be lower than 90% of the expected price\n"
"You must reduce the expected price if you want to accept this offer"
)

Comment thread estate/models/estate_property.py Outdated
Comment on lines +75 to +80
if record.selling_price > 0:
offer_percentage = record.selling_price / record.expected_price
# if offer percentage lower then 90%
if float_compare(offer_percentage,
0.9, precision_digits=2) == -1:
raise ValidationError(f"{m1}. {m2}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I believe in practice it would be better to keep the multiplication instead of the division to avoid x / 0 issue (expected_price is not checked here). Also try using the float_is_zero to ensure there is no issue with floats (and you can format function calls in a cleaner way):

Suggested change
if record.selling_price > 0:
offer_percentage = record.selling_price / record.expected_price
# if offer percentage lower then 90%
if float_compare(offer_percentage,
0.9, precision_digits=2) == -1:
raise ValidationError(f"{m1}. {m2}")
if float_is_zero(record.selling_price, precision_digits=2):
continue
min_price = 0.9 * property.expected_price
if float_compare(record.selling_price, min_price, precision_digits=2) == -1:
raise ValidationError("...")

def action_accepted(self):
for record in self:
if record.property_id.selling_price == 0:
record.status = "accepted"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check if it doesn't already have an accepted offer ?

Comment on lines +57 to +58
else:
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some cleanup might be needed here

Comment thread estate/models/estate_propery_offer.py Outdated
Comment on lines +63 to +64
raise ValidationError(
"You're not eligible to refused an accepted offer")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I prefer this notation but I think both are okay in the codebase

Suggested change
raise ValidationError(
"You're not eligible to refused an accepted offer")
raise ValidationError(
"You're not eligible to refused an accepted offer"
)

Comment thread estate/security/ir.model.access.csv Outdated
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1
estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1 No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

New line needed here 👀 (it's the case in all odoo files)

Comment thread estate/__manifest__.py Outdated
'summary': 'Track leads and close opportunities',
'website': 'https://www.odoo.com/app/estate',
'depends': [
'base'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nitpicking, add what is needed to easily add new elements later on:

Suggested change
'base'
'base',

yogietama and others added 5 commits April 27, 2026 16:47
This commit is here to introduce the testing framework of Odoo. Try running the
tests using `--test-tags :TestEstateProperty`.

Doc:
https://www.odoo.com/documentation/18.0/developer/reference/backend/testing.html?highlight=tests#invocation

The tests were made such that the first one should work but the second one
should fail. Your job is to ensure both tests pass in the end. You should update
the behaviour of the appropriate models.

If you want, you can also add a small test of your own to get a feel for it.

Chapter 15: The final word
@yogietama yogietama force-pushed the 19.0-onboarding-yomet branch from 0bcf5fe to feb7edb Compare April 28, 2026 14:43
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.

4 participants