Skip to content

First module created#1234

Open
covey-odoo wants to merge 13 commits intoodoo:19.0from
odoo-dev:19.0-covey-technical-training
Open

First module created#1234
covey-odoo wants to merge 13 commits intoodoo:19.0from
odoo-dev:19.0-covey-technical-training

Conversation

@covey-odoo
Copy link
Copy Markdown

@covey-odoo covey-odoo commented Apr 21, 2026

Creation of Estate Module:

  • Initial model created
  • Initial menu created

@robodoo
Copy link
Copy Markdown

robodoo commented Apr 21, 2026

Pull request status dashboard

@covey-odoo covey-odoo marked this pull request as ready for review April 21, 2026 13:15
@Mathilde411 Mathilde411 requested a review from delcourtfl April 21, 2026 13:31
@covey-odoo covey-odoo force-pushed the 19.0-covey-technical-training branch from 6c4f13f to fce6075 Compare April 22, 2026 07:47
@covey-odoo covey-odoo force-pushed the 19.0-covey-technical-training branch from c98f6fa to 64d81ad Compare April 22, 2026 08:04
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.

Also it seems your first commits have 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)

Comment thread estate/models/estate_property.py Outdated
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
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 line is not needed anymore

Comment thread estate/models/estate_property.py Outdated
string='Type',
selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')],
help="this is used to indicated the garden orientation"
) 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.

It's recommended to have one empty line at the end of each file

Comment thread estate/__manifest__.py Outdated
'author': "covey",
'website': "",
'category': 'Tutorials',
'version': '0.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.

Suggested change
'version': '0.1',
'version': '19.0.0.1.0',

First 2 numbers of the version are the odoo version, and the 3 next are your module's version. This will prevent your module to be installed in another version than 19.0 in this instance. (Standard modules don't do it because they are 19.0)

Comment thread estate/__manifest__.py Outdated
'version': '0.1',
'application': True,
'installable': True,
'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.

Suggested change
'depends': ['base'],
'depends': [
'base',
],

Most of the time it's better to keep arrays formatted in a way that will limit further diff, and doesn't break the git blame when we need to add some additional dependencies

Comment thread estate/__manifest__.py Outdated
Comment on lines +13 to +14
'author': "covey",
'website': "",
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
'author': "covey",
'website': "",
'author': 'covey',
'website': '',

Try to avoid mixing single and double quote when it's not needed

@covey-odoo covey-odoo force-pushed the 19.0-covey-technical-training branch 2 times, most recently from 145cd42 to aa12051 Compare April 24, 2026 09:21
@covey-odoo covey-odoo force-pushed the 19.0-covey-technical-training branch from aa12051 to cfe6336 Compare April 24, 2026 09:26
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 ! Everything is quite good already, just added a few minor remarks.

Comment thread estate/models/estate_property.py Outdated
Comment on lines +89 to +105
if float_is_zero(record.selling_price, precision_digits=2) or float_is_zero(
record.expected_price, precision_digits=2
):
raise ValidationError(
"Selling price and expected price must be greater than zero."
)
if (
float_compare(
record.selling_price,
record.expected_price * 0.9,
precision_digits=2,
)
< 0
):
raise ValidationError(
"Selling price cannot be lower than 90%of expected price!"
)
Copy link
Copy Markdown

@delcourtfl delcourtfl Apr 24, 2026

Choose a reason for hiding this comment

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

This function is not that readable, I suppose it's what a linter would suggest to avoid too long lines (+80 char), but I think it can be improved in a few ways (avoid inconsistent line breaks, use temp variables, ...), for example:

Suggested change
if float_is_zero(record.selling_price, precision_digits=2) or float_is_zero(
record.expected_price, precision_digits=2
):
raise ValidationError(
"Selling price and expected price must be greater than zero."
)
if (
float_compare(
record.selling_price,
record.expected_price * 0.9,
precision_digits=2,
)
< 0
):
raise ValidationError(
"Selling price cannot be lower than 90%of expected price!"
)
if any(
float_is_zero(value, precision_digits=2)
for value in [record.selling_price, record.expected_price]
):
raise ValidationError(
"Selling price and expected price must be greater than zero."
)
if float_compare(
record.selling_price,
record.expected_price * 0.9,
precision_digits=2,
) < 0:
raise ValidationError(
"Selling price cannot be lower than 90% of expected price!"
)

Comment thread estate/models/estate_property_offer.py Outdated
Comment on lines +9 to +11
_check_offer_price_positive = models.Constraint(
"CHECK(price > 0)", "The offer 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.

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

Comment thread estate/__manifest__.py Outdated
"version": "19.0.0.1.0",
"application": True,
"installable": True,
"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.

Suggested change
"depends": ["base"],
"depends": [
"base",
],

covey-odoo and others added 2 commits April 28, 2026 10:26
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.
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.

Good work, just a few formatting nitpicks.

Also to end this part in a clean way you should squash your commits (using an interactive rebase) into:

  • one for estate module
  • one for estate_account module

(And don't forget to check the runbot style CI 👀)

record.garden_area = 0
record.garden_orientation = None

def cancel_sale(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Better to explicitly keep action in the name in this case (so that we know it's coming from the ui): action_cancel_sale

for record in self:
record.state = "cancelled"

def mark_as_sold(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same as above: action_mark_as_sold

Comment thread estate/tests/__init__.py
@@ -0,0 +1 @@
from . import test_estate_property 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.

😢

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