Skip to content

Server framework 101#1339

Open
LucasDaniOV wants to merge 17 commits into
odoo:19.0from
odoo-dev:19.0-onboarding-luoud
Open

Server framework 101#1339
LucasDaniOV wants to merge 17 commits into
odoo:19.0from
odoo-dev:19.0-onboarding-luoud

Conversation

@LucasDaniOV

Copy link
Copy Markdown

No description provided.

@LucasDaniOV LucasDaniOV requested a review from ziriraha June 15, 2026 09:45
@robodoo

robodoo commented Jun 15, 2026

Copy link
Copy Markdown

Pull request status dashboard

@ziriraha ziriraha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

looks good, one thing to keep in mind is that you should add a new link at the end of each file. i recommend setting up your editor to add it for you.

Comment thread estate/__manifest__.py Outdated
Comment thread estate/models/estate_property.py
@LucasDaniOV LucasDaniOV changed the title Server framework 101 - chapter 2 Server framework 101 Jun 16, 2026
@LucasDaniOV LucasDaniOV force-pushed the 19.0-onboarding-luoud branch from 7b557ac to c06fdb3 Compare June 16, 2026 11:01

@ziriraha ziriraha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice work

Comment thread estate/models/estate_property.py Outdated
@LucasDaniOV

Copy link
Copy Markdown
Author

nice work

thank you

@ziriraha ziriraha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job, a couple small comments

msg_0 = "Property is already sold"
raise exceptions.UserError(msg_0)
property.state = "sold"
return 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.

fyi (i dont know if its explained in the tutorial) actions can return action objects so you can say things like: open this popup, reload the page, redirect to here

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

useless file

Comment on lines +54 to +56
"""
Relational fields
"""

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 personally dont like these separation comments, some people add them but then others when changing the code they put everything wherever they want and they become useless

nitpick: Also I prefer # instead of """ for multiline comments

Comment on lines +160 to +161
msg = "Selling price cannot be lower than ninety percent of expected price"
raise exceptions.ValidationError(msg)

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
msg = "Selling price cannot be lower than ninety percent of expected price"
raise exceptions.ValidationError(msg)
raise exceptions.ValidationError(self.env._("Selling price cannot be lower than ninety percent of expected price"))

You can inline it and you should make it translatable

Another nitpick: but i prefer if you import from odoo.exceptions import ValidationError instead of using it this way

@api.model
def create(self, vals_list):
for vals in vals_list:
property = self.env["estate.property"].browse(vals["property_id"])

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 going to explode query count, you should do a browse outside the for loop and the use that recordset to browse it (again) for the correct id, something like:

properties = self.env["estate.property"].browse([vals["property_id"] for vals in vals_list])

for vals in vals_list:
    property = properties.browse(vals["property_id"])

The first call saves them on cache, the second one just retrieves the one needed

</list>
</field>
</record>
</odoo> 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 eof

Comment on lines +4 to +8
"installable": True,
"application": True,
"data": [
"security/ir.model.access.csv",
],

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
"installable": True,
"application": True,
"data": [
"security/ir.model.access.csv",
],

not really as its a module that will connect both apps (not an app itself), in any case we would put auto_install: True so it automatically installs when you have estate and account apps.

@@ -0,0 +1,11 @@
{
"name": "Real Estate Account",
"depends": ["base_setup", "estate", "account"],

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_setup", "estate", "account"],
"depends": ["estate", "account"],

base_setup is implied from the other modules

Comment thread estate/__manifest__.py
@@ -0,0 +1,17 @@
{
"name": "Real Estate",
"depends": ["base_setup"],

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_setup"],
"depends": ["base"],

You dont need base_setup here

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