-
Notifications
You must be signed in to change notification settings - Fork 2.6k
JEDEL Onboarding #998
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
base: 19.0
Are you sure you want to change the base?
JEDEL Onboarding #998
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.
Small comments :)
estate/models/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
from . import estate_property No newline at end of file |
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.
End of file line is missing here
estate/security/ir.model.access.csv
Outdated
@@ -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,0,0,0 No newline at end of file |
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.
End of file line is missing here
estate/security/ir.model.access.csv
Outdated
@@ -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,0,0,0 No newline at end of file |
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.
estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,0,0,0 | |
estate.access_estate_property,access_estate_property,model_estate_property,base.group_user,1,0,0,0 |
It's an xmlid from your own module so you can remove the module part :)
estate/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
from . import models No newline at end of file |
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.
End of file line is missing here
estate/__manifest__.py
Outdated
'data' : [ | ||
'security/ir.model.access.csv' | ||
], | ||
} No newline at end of file |
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.
End of file line is missing here
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.
Good work here !
I see that your runbot is red because of style, so you may fix that.
Also be mindful about the naming of files/xmlids: https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#xml-ids-and-naming
estate/models/estate_property.py
Outdated
description = fields.Text() | ||
postcode = fields.Char() | ||
notes = fields.Html() | ||
date_availability = fields.Date(copy=False, default=datetime.date.today() + relativedelta(months=+3)) |
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.
date_availability = fields.Date(copy=False, default=datetime.date.today() + relativedelta(months=+3)) | |
date_availability = fields.Date(copy=False, default=lambda self: datetime.date.today() + relativedelta(months=+3)) |
Use a lambda here, or the version that has been evaluated the first time will always be used.
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.
And why months=+3
?
garden_area = fields.Integer() | ||
garden_orientation = fields.Selection(selection=[("north", "North"), ("south", "South"), ("east", "East"), ("west", "West")]) | ||
active = fields.Boolean(default=True) | ||
state = fields.Selection(selection=[("new", "New"), ("offer_received", "Offer Received"), ("offer_accepted", "Offer Accepted"), ("sold", "Sold"), ("cancelled", "Cancelled")], copy=False, required=True, 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.
state = fields.Selection(selection=[("new", "New"), ("offer_received", "Offer Received"), ("offer_accepted", "Offer Accepted"), ("sold", "Sold"), ("cancelled", "Cancelled")], copy=False, required=True, default="new") | |
state = fields.Selection(selection=[ | |
("new", "New"), | |
("offer_received", "Offer Received"), | |
("offer_accepted", "Offer Accepted"), | |
("sold", "Sold"), | |
("cancelled", "Cancelled"), | |
], copy=False, required=True, default="new") |
Line is way too long
@api.constrains('expected_price', 'selling_price') | ||
def _check_selling_price(self): | ||
for record in self: | ||
if not float_is_zero(record.selling_price, precision_digits=3): | ||
if float_compare(record.selling_price, record.expected_price*0.9, precision_digits=3) < 0: | ||
raise UserError(r"The selling price must be at least 90% of the expected price !") |
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.
Be careful about model attribute order: https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#symbols-and-conventions
@api.depends("create_date", "validity") | ||
def _compute_deadline(self): | ||
for offer in self: | ||
offer.date_deadline = fields.Date.add(offer.create_date, days=offer.validity) | ||
|
||
def _inverse_deadline(self): | ||
for offer in self: | ||
delta = offer.date_deadline - offer.create_date | ||
offer.validity = delta.days |
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.
create_date is not required here, what happens if you remove it ?
estate/security/ir.model.access.csv
Outdated
estate.access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1 | ||
estate.access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 | ||
estate.access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 | ||
estate.access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 No newline at end of file |
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 newline
<field name="bedrooms"/> | ||
<field name="living_area" string="Living Area (sqm)"/> | ||
<field name="facades"/> | ||
<filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/> |
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.
<filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]"/> | |
<filter string="Available" name="available" domain="[('state', 'in', ('new', 'offer_received'))]"/> |
Simpler way when comparing the same variable :)
No description provided.