Conversation
leclerc-leo
left a comment
There was a problem hiding this comment.
Great job 👍
Try to use more meaningful names and ids which will help other understand your code.
estate/models/estate_property.py
Outdated
| # -*- coding: utf-8 -*- | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
There was a problem hiding this comment.
This isn't needed anymore and can be removed.
estate/__manifest__.py
Outdated
| # -*- coding: utf-8 -*- | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
||
|
|
There was a problem hiding this comment.
same here, this isn't needed anymore
estate/__manifest__.py
Outdated
|
|
||
| { | ||
| 'name': 'Estate', | ||
| 'version': '1.9', |
There was a problem hiding this comment.
| 'version': '1.9', | |
| 'version': '1.0', |
When creating a module, it should be on 1.0.
estate/models/estate_property.py
Outdated
| from odoo import fields, models | ||
|
|
||
|
|
||
| class RecurringPlan(models.Model): |
There was a problem hiding this comment.
A better name for this class would be EstateProperty to match the _name you've set
estate/models/estate_property.py
Outdated
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date() | ||
| date_availability = fields.Date(default=fields.Date.today()+relativedelta(months=3), copy=False) |
There was a problem hiding this comment.
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.
estate/models/estate_property.py
Outdated
| 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 |
There was a problem hiding this comment.
| active = fields.Boolean(default=True) # testing the reserved fields thing | |
| active = fields.Boolean(default=True) |
estate/models/estate_property.py
Outdated
| state = fields.Selection(selection=[('new', 'New'), ('offer received', 'Offer Received'), ('offer accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')], | ||
| default='new', | ||
| required=True, | ||
| copy=False | ||
| ) |
There was a problem hiding this comment.
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.
| 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, | |
| ) |
estate/views/estate_menus.xml
Outdated
| <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"/> |
There was a problem hiding this comment.
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.
| <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"/> |
There was a problem hiding this comment.
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.
03a2fed to
6422caa
Compare
c4dc2f6 to
4544ecd
Compare
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 | |||
| access_test_model,access_test_model,model_estate_property,base.group_user,1,1,1,1 | |||
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.

No description provided.