Skip to content

Tutorials #1202

Open
andha-odoo wants to merge 24 commits intoodoo:19.0from
odoo-dev:19.0-tutorials-estate-andha
Open

Tutorials #1202
andha-odoo wants to merge 24 commits intoodoo:19.0from
odoo-dev:19.0-tutorials-estate-andha

Conversation

@andha-odoo
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Mar 16, 2026

Pull request status dashboard

@andha-odoo andha-odoo changed the title Chapters 1 - 3 Tutorials Mar 16, 2026
@andha-odoo andha-odoo force-pushed the 19.0-tutorials-estate-andha branch from 6449371 to 077ffd7 Compare March 17, 2026 08:59
Copy link

@lost-odoo lost-odoo left a comment

Choose a reason for hiding this comment

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

Hello, Good Job! I have already made a first pass. Feel free to ask if you have any questions 😄

from dateutil.relativedelta import relativedelta

class RecurringPlan(models.Model):
_name = "estate.property"

Choose a reason for hiding this comment

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

We typically use single quotes for strings, and reserve double quotes for user-facing text.

Suggested change
_name = "estate.property"
_name = 'estate.property'

I'll let you modify it at other places

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

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 here; otherwise, this value will be evaluated at server start and remain static.

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 No newline at end of file

Choose a reason for hiding this comment

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

Missing new line

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 No newline at end of file

Choose a reason for hiding this comment

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

Suggested change
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1
access.estate.property.user,access_estate_property_user,estate.model_estate_property,base.group_user,1,1,1,1

<menuitem id="estate_model_menu_action" action="estate_property_action"/>
</menuitem>
</menuitem>
</odoo> No newline at end of file

Choose a reason for hiding this comment

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

Here too

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="estate_property_menu_root" name="Estate Properties">
<menuitem id="properties" name="Properties">

Choose a reason for hiding this comment

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

Suggested change
<menuitem id="properties" name="Properties">
<menuitem id="estate_properties_menu" name="Properties">

<odoo>
<menuitem id="estate_property_menu_root" name="Estate Properties">
<menuitem id="properties" name="Properties">
<menuitem id="estate_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.

Suggested change
<menuitem id="estate_model_menu_action" action="estate_property_action"/>
<menuitem id="estate_property_action" action="estate_property_action"/>

@andha-odoo andha-odoo force-pushed the 19.0-tutorials-estate-andha branch from dd1d706 to e9e2d4c Compare March 17, 2026 14:35
Copy link

@lost-odoo lost-odoo left a comment

Choose a reason for hiding this comment

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

Hello, Good job !

I have made my last review for the ORM training. Don't forget to fix those comments and then resolve them on github 😄

name = fields.Char(required=True)
class EstateProperty(models.Model):
_name = 'estate.property'
_description = 'A specific property'

Choose a reason for hiding this comment

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

Double quotes here as it is a string that will be shown to the user

def action_sold(self):
for record in self:
if record.state == 'cancelled':
raise exceptions.UserError('A cancelled listing cannot be sold')

Choose a reason for hiding this comment

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

You should import UserError directly instead of using exceptions.UserError

def action_sold(self):
for record in self:
if record.state == 'cancelled':
raise exceptions.UserError('A cancelled listing cannot be sold')

Choose a reason for hiding this comment

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

Also it needs to be translated using self.env._("A cancelled listing cannot be sold.")

Do not forget about double quotes also 😄

Comment on lines +121 to +124
raise exceptions.ValidationError(
'The selling price must be at least 90%% of the expected price'
)

Choose a reason for hiding this comment

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

Same here and for every other exceptions ^^

Comment on lines +118 to +120
if float_compare(
record.selling_price, record.expected_price * 0.9, 2
) == -1 and not float_is_zero(record.selling_price, 2):

Choose a reason for hiding this comment

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

if float_compare(record.selling_price, record.expected_price * 0.9, 2) == -1 
    and not float_is_zero(record.selling_price, 2):

This is easier to read IMO 😄

@api.model_create_multi
def create(self, vals_list):
for val in vals_list:
property_for_offer = self.env['estate.property'].browse(val['property_id'])

Choose a reason for hiding this comment

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

Avoid doing a browse in a loop because that way you make a lot of sql queries. You can browse all of them beforehand then use the records in the loop.


class EstatePropertyType(models.Model):
_name = 'estate.property.tag'
_description = 'A property tag'

Choose a reason for hiding this comment

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

The Description is not really a description I know it is confusing haha. It should be the Display String of the Model.
So here for instance : "Property Tag" and for estate.property.offer: "Property Offer".

Don't forget to change it for all models ^^

'estate.property',
'salesperson_id',
string='Property',
domain="['|', ('state', '=', 'New'), ('state', '=', 'Offer Received')]",

Choose a reason for hiding this comment

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

The domain should not be in a string. You can directly pass the list otherwise it should not work.

Comment on lines +2 to +3
<odoo>
</odoo>

Choose a reason for hiding this comment

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

Empty file here 👀

Comment on lines 128 to +132
# Pyre type checker
.pyre/

# Linting
pyproject.toml

Choose a reason for hiding this comment

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

You should not push this

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