ollet - Technical Training - #1414
ollet-odoo wants to merge 13 commits into
Conversation
task-6573598
189c49d to
b592011
Compare
task-6573598
072738c to
acc1335
Compare
There was a problem hiding this comment.
Good job 🔥
Just for some commit messages, we write it in a way that aligns with when this commit is merged it will ..... so for example estate: Basic security can be add access rules to estate_property or however you would like to describe your change :)
refer to Git Guidlines
I also left you some comments :)
feel free to ping me when you need another review, also always make sure your runbot is green ahead please :)
| <menuitem id="estate_property_menu_action" action="estate_property_action"/> | ||
| </menuitem> | ||
| </menuitem> | ||
| </odoo> No newline at end of file |
There was a problem hiding this comment.
Always add a new line at end of files :)
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <menuitem id="estate_menu_root" name="Real Estate"> | ||
| <menuitem id="estate_first_level_menu" name="Advertisements"> |
There was a problem hiding this comment.
it's better to give ids a descriptive name rather than first_level_menu :)
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
| <record id="estate_property_view_tree" model="ir.ui.view"> |
There was a problem hiding this comment.
| <record id="estate_property_view_tree" model="ir.ui.view"> | |
| <record id="estate_property_view_tree" model="ir.ui.view"> |
it's not gonna break the xml but it's better aligned to be debugged easier in the future
| @@ -0,0 +1 @@ | |||
| from .property import Property No newline at end of file | |||
| _name = "estate.property" | ||
| _description = "Real estate property" | ||
|
|
||
| name = fields.Char(required=True, string='Title') |
There was a problem hiding this comment.
it's just a convention to have the string as the first attribute
| living_area = fields.Integer(string="Living Area (sqm)") | ||
| faces = fields.Integer() | ||
| garage = fields.Boolean() | ||
| garden = fields.Boolean() |
There was a problem hiding this comment.
Good practice to have boolean fields on the form is_something or has_something so you might change this to has_garden and has_garage
| garden_orientation = fields.Selection( | ||
| selection=(('north', 'North'), ('east', 'East'), ('south', 'South'), ('west', 'West'))) |
There was a problem hiding this comment.
| garden_orientation = fields.Selection( | |
| selection=(('north', 'North'), ('east', 'East'), ('south', 'South'), ('west', 'West'))) | |
| garden_orientation = fields.Selection( | |
| selection=[ | |
| ('north', 'North'), | |
| ('east', 'East'), | |
| ('south', 'South'), | |
| ('west', 'West'), | |
| ] | |
| ) |
We usually use the [] for the selection attribute and style it like this with multiple values.
if you want to apply the nitpick mentioned in the previous commit which is used by some teams, you will have ('north', "North") instead of ('north', 'North')
| state = fields.Selection(default='new', required=True, copy=False, | ||
| selection=(('new', 'New'), ('offer_received', 'Offer Received'), | ||
| ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), | ||
| ('cancelled', 'Cancelled'))) |
| @@ -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,0 No newline at end of file | |||
There was a problem hiding this comment.
no need to add estate. here in the id, the file is already defined in that module, but you may want to add _user at the end of the id so that it's access_estate_property_user, it's just gives you the chance to make other rules for the same module with different users like _manager for example
| 'data/estate_property_views.xml', | ||
| 'data/estate_menus.xml' | ||
| ], | ||
| 'author': "Olivier Le Thanh Duong", |
task-6573598
task-6573598
37f6405 to
18d1370
Compare
|
@msho-odoo Thanks for the review, i have corrected according to your remarks. I don't know if I should mark the conversation as resolved when I fix them or if you will do it when you do the review again |
Usually resolving the comment would depend on the team or the reviewer and what they prefer :) |
msho-odoo
left a comment
There was a problem hiding this comment.
Good work 👍
Just try to use git commit --amend instead of just git commit when fixing few stuff like spaces, names, quotes, etc. because the same commit still applies, no need to add the fixes to a new commit.
Also, left you a few changes.
Keep it up 🔥
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <menuitem id="estate_menu_root" name="Real Estate"> | ||
| <menuitem id="estate_Advertisements_menu" name="Advertisements"> |
There was a problem hiding this comment.
| <menuitem id="estate_Advertisements_menu" name="Advertisements"> | |
| <menuitem id="estate_advertisements_menu" name="Advertisements"> |
I would stick to the snake case here :), let's make it all small letters
| </h1> | ||
| </div> | ||
| <group> | ||
|
|
There was a problem hiding this comment.
nitpick: when xml becomes bigger, it makes it easier to read if we get rid of these inside empty lines 😅
You can leave an empty line between records maybe but not preferably here :)
| state = fields.Selection(default='new', required=True, copy=False, | ||
| selection=[ | ||
| ('new', "New"), | ||
| ('offer_received', "Offer Received"), | ||
| ('offer_accepted', "Offer Accepted"), | ||
| ('sold', "Sold"), | ||
| ('cancelled', "Cancelled") | ||
| ] | ||
| ) |
There was a problem hiding this comment.
| state = fields.Selection(default='new', required=True, copy=False, | |
| selection=[ | |
| ('new', "New"), | |
| ('offer_received', "Offer Received"), | |
| ('offer_accepted', "Offer Accepted"), | |
| ('sold', "Sold"), | |
| ('cancelled', "Cancelled") | |
| ] | |
| ) | |
| state = fields.Selection( | |
| default='new', | |
| required=True, | |
| copy=False, | |
| selection=[ | |
| ('new', "New"), | |
| ('offer_received', "Offer Received"), | |
| ('offer_accepted', "Offer Accepted"), | |
| ('sold', "Sold"), | |
| ('cancelled', "Cancelled") | |
| ] | |
| ) |
| @@ -0,0 +1,2 @@ | |||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | |||
| estate.access_estate_property_user,access_estate_property,model_estate_property,base.group_user,1,1,1,0 No newline at end of file | |||
| @@ -0,0 +1,2 @@ | |||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | |||
| estate.access_estate_property_user,access_estate_property,model_estate_property,base.group_user,1,1,1,0 No newline at end of file | |||
There was a problem hiding this comment.
No need to add the estate. before the id, it's implicit since it's in the same module.
I believe you should give unlink access to the user, here you're setting the perm_unlink to 0
| 'depends': ['base'], | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'data/estate_property_views.xml', |
There was a problem hiding this comment.
The views file and the menus file should be in views folder not data folder

task-6573598