ollet - Technical Training - #1414
ollet-odoo wants to merge 31 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 :)
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 🔥
| 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
There was a problem hiding this comment.
I was using the line suggested in the log as a base.
Is it a consistency rule to note have it in it's own module or just a hint you are giving me?
There was a problem hiding this comment.
I am just giving you the reasoning why you don't need the <module_name>. before the id in this case but it's not a big thing
| '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
|
robodoo rebase-merge |
|
Merge method set to rebase and merge, using the PR as merge commit message. |
8de9400 to
c0879b8
Compare
Add model, views, security and many2one
add model, views, security and links
add model, views, security and links
5d2b876 to
cf79289
Compare
msho-odoo
left a comment
There was a problem hiding this comment.
Thank you for the good work 🔥
Left you a couple of comments (some of them are nitpicks so, you can attend to the important one first :))
Also please ping me when you finish a chapter for a review so that changes are not too much to review and I know whether you missed something in the code or you didn't get to that chapter yet:)
but thanks, keep it up 👍
e5e4802 to
a4907f5
Compare
1d537d9 to
f7be358
Compare
|
I have finished chapter 11 and the tests are passing if you could please review again. |
f7be358 to
9f5e770
Compare
msho-odoo
left a comment
There was a problem hiding this comment.
Thank you, Good work!
Left you small suggestions and nitpicks for chapter 11, no big thing
| for record in property_id.offer_ids: | ||
| if record.price > vals['price']: | ||
| raise UserError("Cannot create an offer with a lower value than an existing one") |
There was a problem hiding this comment.
It's correct of course, you can also use max() and mapped(), you will do the same thing in one line and without for loops, if you like
| class PropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Property Type" | ||
| _order = "sequence asc" |
There was a problem hiding this comment.
I think the type also wants order by name
| <list editable="bottom" | ||
| decoration-success="status == 'accepted'" | ||
| decoration-danger="status == 'refused'" | ||
| > |
There was a problem hiding this comment.
We don't like a very long line but this one is fine, it makes it easier to read the file :)
| <list editable="bottom" | |
| decoration-success="status == 'accepted'" | |
| decoration-danger="status == 'refused'" | |
| > | |
| <list editable="bottom" decoration-success="status == 'accepted'" decoration-danger="status == 'refused'"> |
| <field name="validity"/> | ||
| <field name="date_deadline"/> | ||
| <button name="action_accept" title="Accept" type="object" icon="fa-check" | ||
| invisible="property_id_state in ('offer_accepted', 'sold', 'cancelled')" |
There was a problem hiding this comment.
surely it's correct, but usually teams avoid adding new fields to the database unless absolutely necessary. It's no big issue here, it's a related field already but thought to mention it
For example here, if you already don't show an offer for cancelled or sold properties, you can just make the invisible condition here be something like state != False
| <button name="action_do_sold" type="object" class="oe_highlight" string="Sold" | ||
| invisible="state in ('sold', 'cancelled', 'new')"/> | ||
| <button name="action_do_cancel" type="object" string="Cancel" | ||
| invisible="state in ('sold', 'cancelled',)"/> |
There was a problem hiding this comment.
nitpick
| invisible="state in ('sold', 'cancelled',)"/> | |
| invisible="state in ('sold', 'cancelled')"/> |
| <field name="property_type_id" widget="many2one" can_create="false" | ||
| can_write="false" | ||
| options="{'no_create': true}" |
There was a problem hiding this comment.
I believe yours is correct, here is also a more used way if you like
| <field name="property_type_id" widget="many2one" can_create="false" | |
| can_write="false" | |
| options="{'no_create': true}" | |
| <field name="property_type_id" widget="many2one" options="{'no_create': True, 'no_edit': True}"/> |

task-6573598