Skip to content

Up to chapter 3#1199

Open
abotaha23 wants to merge 17 commits intoodoo:19.0from
abotaha23:19.0
Open

Up to chapter 3#1199
abotaha23 wants to merge 17 commits intoodoo:19.0from
abotaha23:19.0

Conversation

@abotaha23
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Mar 16, 2026

Pull request status dashboard

Copy link

@leclerc-leo leclerc-leo left a comment

Choose a reason for hiding this comment

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

Great job 👍

Try to use more meaningful names and ids which will help other understand your code.

Comment on lines +1 to +3
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

Choose a reason for hiding this comment

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

This isn't needed anymore and can be removed.

Comment on lines +1 to +4
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.


Choose a reason for hiding this comment

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

same here, this isn't needed anymore


{
'name': 'Estate',
'version': '1.9',

Choose a reason for hiding this comment

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

Suggested change
'version': '1.9',
'version': '1.0',

When creating a module, it should be on 1.0.

from odoo import fields, models


class RecurringPlan(models.Model):

Choose a reason for hiding this comment

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

A better name for this class would be EstateProperty to match the _name you've set

description = fields.Text()
postcode = fields.Char()
date_availability = fields.Date()
date_availability = fields.Date(default=fields.Date.today()+relativedelta(months=3), copy=False)

Choose a reason for hiding this comment

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

You should use a lambda instead of directly giving it a value.
As the value used by default here would be computed when the server starts so if your server ran for 2 months, the date_availability would be only offset by a month.

garden_area = fields.Integer()
garden_orientation = fields.Selection(selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]) No newline at end of file
garden_orientation = fields.Selection(selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')])
active = fields.Boolean(default=True) # testing the reserved fields thing

Choose a reason for hiding this comment

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

Suggested change
active = fields.Boolean(default=True) # testing the reserved fields thing
active = fields.Boolean(default=True)

Comment on lines +26 to +30
state = fields.Selection(selection=[('new', 'New'), ('offer received', 'Offer Received'), ('offer accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
default='new',
required=True,
copy=False
)

Choose a reason for hiding this comment

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

Here's how we would format this, Also you should use double quotes for any string that's going to be displayed to the user.

Suggested change
state = fields.Selection(selection=[('new', 'New'), ('offer received', 'Offer Received'), ('offer accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
default='new',
required=True,
copy=False
)
state = fields.Selection(
selection=[
('new', "New"),
('offer received', "Offer Received"),
('offer accepted', "Offer Accepted"),
('sold', "Sold"),
('cancelled', "Cancelled"),
],
default='new',
required=True,
copy=False,
)

Comment on lines +2 to +4
<menuitem id="test_menu_root" name="Real Estate">
<menuitem id="test_first_level_menu" name="First Level">
<menuitem id="test_model_menu_action" action="estate_property_action"/>

Choose a reason for hiding this comment

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

Try to use id that represent what is inside.
This will help when you are debugging to identify which one has an issue more easily and will help others that read your code understand it better.

Suggested change
<menuitem id="test_menu_root" name="Real Estate">
<menuitem id="test_first_level_menu" name="First Level">
<menuitem id="test_model_menu_action" action="estate_property_action"/>
<menuitem id="menu_real_estate" name="Real Estate">
<menuitem id="menu_real_estate_first_level" name="First Level">
<menuitem id="menu_real_estate_properties" action="estate_property_action"/>

<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Tests">
<field name="name" string="Title"/>

Choose a reason for hiding this comment

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

Instead of settings string="X" in the view, It's better to set the string="X" on the field directly.
That way, if you display the field in different view, you wont have to add string= in both of those views.

@abotaha23 abotaha23 force-pushed the 19.0 branch 2 times, most recently from 03a2fed to 6422caa Compare March 19, 2026 09:47
@abotaha23 abotaha23 force-pushed the 19.0 branch 5 times, most recently from c4dc2f6 to 4544ecd Compare March 20, 2026 09:51
Copy link

@leclerc-leo leclerc-leo left a comment

Choose a reason for hiding this comment

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

🚀

@@ -0,0 +1,2 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_test_model,access_test_model,model_estate_property,base.group_user,1,1,1,1

This comment was marked as resolved.

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