Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18.0 hello worl sdev #632

Open
wants to merge 12 commits into
base: 18.0
Choose a base branch
from
Open

Conversation

subhadeepdev
Copy link

@subhadeepdev subhadeepdev commented Mar 18, 2025

Completed till Chapter 6.

xxxlease enter the commit message for your changes. Lines starting
@robodoo
Copy link

robodoo commented Mar 18, 2025

Pull request status dashboard

Copy link

@dbeguin dbeguin left a comment

Choose a reason for hiding this comment

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

Hello ! Here is a review, some picky remarks mainly regarding coding guidelines.
Try to keep your diff as clean as possible, even during development / WIP stages, it will help you knowing better what you did and will avoid noise :)

Comment on lines 1 to 18
Table "public.estate_property"
Column | Type | Collation | Nullable | Default
------------------+-----------------------------+-----------+----------+---------------------------------------------
id | integer | | not null | nextval('estate_property_id_seq'::regclass)
number_of_months | integer | | not null |
sequence | integer | | |
create_uid | integer | | |
write_uid | integer | | |
name | jsonb | | not null |
active | boolean | | |
create_date | timestamp without time zone | | |
write_date | timestamp without time zone | | |
Indexes:
"estate_property_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
"estate_property_create_uid_fkey" FOREIGN KEY (create_uid) REFERENCES res_users(id) ON DELETE SET NULL
"estate_property_write_uid_fkey" FOREIGN KEY (write_uid) REFERENCES res_users(id) ON DELETE SET NULL

Copy link

Choose a reason for hiding this comment

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

I think you added an unnecessary file :)

@@ -0,0 +1 @@
from . import estate_property
Copy link

Choose a reason for hiding this comment

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

Global remark: we expect one empty line at the end of each file

Comment on lines 7 to 17
name = fields.Char(required = True)
postcode = fields.Char()
date_availability = fields.Date()
expected_price = fields.Float(required = True)
selling_price = fields.Float()
bedrooms = fields.Integer()
living_area = fields.Integer()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
Copy link

Choose a reason for hiding this comment

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

Always set the label of the field. even if it's obvious and even if the orm will generate one for you using the field name.
postcode = fields.Char("Postcode") or postcode = fields.Char(string="Postcode")
-> better the first in this case, unless string is not the first param. (typically for relational fields)

@@ -0,0 +1,7 @@
{
Copy link

Choose a reason for hiding this comment

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

don't forget the version and a description of the module.

from odoo import fields, models

class EstateProperty(models.Model):
_name = "estate_property"
Copy link

Choose a reason for hiding this comment

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

use '.' instead of '_' in model naming

<field name="bedrooms"/>
<field name="living_area"/>
<field name="facades"/>
<filter string="Archived" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'received')]"/>
Copy link

Choose a reason for hiding this comment

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

you can also use this syntax :
domain="[('state', 'in', ['new', 'received'])]"

Comment on lines 60 to 67
<list string = "Channel">
<field name = "name"/>
<field name = "postcode"/>
<field name = "bedrooms"/>
<field name = "living_area"/>
<field name = "expected_price"/>
<field name = "selling_price"/>
<field name = "date_availability"/>
Copy link

Choose a reason for hiding this comment

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

remove all unecessary white spaces

Comment on lines 56 to 57
<record id="test_model_view_tree" model="ir.ui.view">
<field name="name">test.model.list</field>
Copy link

Choose a reason for hiding this comment

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

guidelines : id and name should be identical (except with '.' and '_')

Comment on lines 21 to 22
state = fields.Selection([('new', 'New'), ('received', 'Offer Received'), ('accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')],
required = True, copy = False, default = 'new')
Copy link

Choose a reason for hiding this comment

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

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

just a matter of coding style :)

Comment on lines 14 to 18
living_area = fields.Integer()
facades = fields.Integer()
garage = fields.Boolean()
garden = fields.Boolean()
garden_area = fields.Integer()
Copy link

Choose a reason for hiding this comment

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

Always set the label of the field. even if it's obvious and even if the orm will generate one for you using the field name.
postcode = fields.Char("Postcode") or postcode = fields.Char(string="Postcode")
-> better the first in this case, unless string is not the first param. (typically for relational fields)

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