-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
first commit #167
base: 18.0
Are you sure you want to change the base?
first commit #167
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello 👋 here's a first review for you 😄
Some teams won't be as nitpicking as i was but in all cases thoses guidelines should get most people to approve your code 👍
estate/models/__init__.py
Outdated
@@ -0,0 +1,6 @@ | |||
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not required in any file anymore, you can just remove it and start on the first line of the file 👍
estate/models/__init__.py
Outdated
from . import estate_property | ||
from . import estate_property_type | ||
from . import estate_property_tags | ||
from . import estate_property_offer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ⛔ (click on the file hyperlink) signs means your forgot to add a newline at the end of file. All files should end with an empty new line 👍
tags_ids = fields.Many2many("estate.property.tags", string='Tags') | ||
offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers") | ||
total_area = fields.Integer(compute=("_compute_total")) | ||
@api.depends("living_area", "garden_area") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All methods should be preceded by a blank line and precede a blank line.
estate/models/estate_property.py
Outdated
if record.create_date == 0: | ||
record.validity = 7 | ||
else: | ||
record.validity = (record.date_deadline - record.create_date).day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing empty line after file's last line 😄
estate/models/estate_property.py
Outdated
state = fields.Selection( | ||
string='State', | ||
selection=[('new', 'New'), ('received', 'Offer Received'), ('accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')], | ||
required=True, | ||
copy=False, | ||
default='new' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When fields definition get too big (and it happens quite often with Selection fields, we try to put as much as possible on different lines, for selection fields, it means you can (and will probably be asked too anyway) do that:
state = fields.Selection( | |
string='State', | |
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') | |
], | |
string='State', | |
required=True, | |
copy=False, | |
default='new' | |
) |
Also the selection list is expected first so it's nice and cleaner to put it first without the selection=
estate/models/estate_property.py
Outdated
validity = fields.Integer(compute="_compute_deadline", inverse="_compute_validity", string="Validity", default=7) | ||
date_deadline = fields.Date(compute="_compute_validity", inverse="_compute_deadline",string="Deadline", default=fields.Date.today()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fields should be before all methods, put that back to the top of the class just before the methods 😄
estate/models/estate_property.py
Outdated
def _compute_total(self): | ||
for record in self: | ||
record.total_area = record.living_area + record.garden_area | ||
best_offer = fields.Float(compute="_compute_maximum") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fields should be before all methods, put that back to the top of the class just before the methods 😄
status = fields.Selection( | ||
string='Status', | ||
selection=[('accepted', 'Accepted'), ('refused', 'Refused')], | ||
help="Offer status", | ||
copy=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another selection field that can be slightly improved regarding the selection=
and the string=
, up to you but in any way, the closing parenthsis has to go to next line 😄
estate/security/ir.model.access.csv
Outdated
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 | ||
estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1 | ||
estate.access_estate_property_tags,access_estate_property_tags,estate.model_estate_property_tags,base.group_user,1,1,1,1 | ||
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing EOL on last line 😉
<menuitem id="estate_property_tags_menu_action" action="estate_property_tags_action"/> | ||
</menuitem> | ||
</menuitem> | ||
</odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing EOL on last line 😉 There are a few more, i won't tag them all 😉
f082e26
to
6b2d099
Compare
No description provided.