Skip to content

onboarding server framework - #1383

Open
snoek100 wants to merge 17 commits into
odoo:19.0from
odoo-dev:19.0-onboarding-kehey
Open

onboarding server framework #1383
snoek100 wants to merge 17 commits into
odoo:19.0from
odoo-dev:19.0-onboarding-kehey

Conversation

@snoek100

Copy link
Copy Markdown

No description provided.

@robodoo

robodoo commented Aug 17, 2026

Copy link
Copy Markdown

Pull request status dashboard

@yoba-odoo yoba-odoo 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 work 💪
Can you just keep it one commit per chapter? That would be easier to follow

Also the commit titles has to follow the guidelines here

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

Keep in mind to always add a newline in the end of each file

Comment thread estate/__manifest__.py Outdated
Comment on lines +11 to +13
'views': [

],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We can remove this I don't think we need it since we are already defining the views in the data key

Comment thread estate/views/estate_property_views.xml Outdated
<field name="model">estate.property</field>
<field name="arch" type="xml">
<search string="Search">
<field name="name" string="Title"/>

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 will work fine but to avoid setting a string for each field in each view you can add this string to the field definition in python and it will be used everywhere you call this field in XML

Comment thread estate/models/estate_property.py Outdated
from odoo import fields, models
from dateutil.relativedelta import relativedelta

class TestModel(models.Model):

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 know this is a tutorial 😅 but avoid to name anything test unless it is a real test as this is the convention we use for unit test files

@yoba-odoo yoba-odoo 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 👌
While applying the changes try to make the ci/* checks pass

string='type',
selection=[('north', 'North'), ('south', 'South'), ('East', 'east'), ('West', 'west')],
)
total_area = fields.Integer(string="Total Area", compute="_compute_total_surface")

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_area = fields.Integer(string="Total Area", compute="_compute_total_surface")
total_area = fields.Integer(string="Total Area", compute="_compute_total_area")

We normally tend to name the compute method after the exact name of field

return True

@api.ondelete(at_uninstall=False)
def ondelete(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.

It is kinda a nitpick but we usually name those method as _unlink_**** for example:

Suggested change
def ondelete(self):
def _unlink_except_new_cancelled(self):

Comment on lines +29 to +33
for record in self:
if record.create_date:
record.date_deadline = record.create_date + relativedelta(days=record.validity)
else:
record.date_deadline = fields.Datetime.today() + relativedelta(days=record.validity)

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
for record in self:
if record.create_date:
record.date_deadline = record.create_date + relativedelta(days=record.validity)
else:
record.date_deadline = fields.Datetime.today() + relativedelta(days=record.validity)
for record in self:
check_date = record.create_date if record.create_date else fields.Datetime.today()
record.date_deadline = check_date + relativedelta(days=record.validity)

To avoid duplicating some of the code we can do this, wdyt?


# ===========button actions===========
def action_accept(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.

Nitpick 😇 not a needed line

Comment thread estate/models/estate_property_offer.py Outdated
property = self.env["estate.property"].browse(to_create["property_id"])
new_bid = to_create["price"]
for offer in property.offer_ids:
if offer.price > new_bid:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

since you introduced an order for the offers here https://github.com/odoo/tutorials/pull/1383/changes#diff-8000c23a2907f34f0cc387be9dc4178411fda81b674724854bd4d048f9e11b16R9 the recordset will be ordered upon price by default so normally offer_ids[0] will have the offer that has the highest price

@@ -0,0 +1,10 @@
from odoo import fields, models

class InheritedModel(models.Model):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When inherit a model we name the class the same as the parent class

@@ -0,0 +1,62 @@
<?xml version="1.0"?>

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 a better practice to have a XML view file for each model.
So here separate the estate_property and the estate_property_type and estate_property_tag and estate_property_offer views each in a separate file

@@ -0,0 +1,180 @@
<?xml version="1.0"?>

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 ☝️

prevent other people from breaking the reset of the estate's garden area and orientation when a garden is present
In order to improve readability estate views which
were all in one file have been refactored such that
every view has their own file named according to their id.
…n be set.

Since the requirements don't allow the property type to be edited directly in the list view
a field has been created in the form view to allow setting the property type.
added a component containing a button and a counter such that the button increments the counter.
also added a component which creates its own children buttons such that it's possible to have a global counter of all the children buttons.
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