Conversation
AlessandroLupo
left a comment
There was a problem hiding this comment.
Nice work! :D I added a couple of comments. Please make sure that your commit messages follow the guidelines. 👍
estate/models/__init__.py
Outdated
| # -*- coding: utf-8 -*- | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
||
| from . import estate_property No newline at end of file |
There was a problem hiding this comment.
Remember to add an empty line at the end of each file ;)
91e995b to
34e5c4f
Compare
AlessandroLupo
left a comment
There was a problem hiding this comment.
Thanks for the changes, it looks fine now! 👍
AlessandroLupo
left a comment
There was a problem hiding this comment.
Good job, it's nice that you got a green runbot. 👍 I added a couple of minor comments.
As a git exercise, you could try to do an interactive rebase and leave only one commit per chapter (you could also add the chapter number to the commit messages). To achieve this, you could just squash the commit fixing the runbot with the previous commit. Let me know if you need support with git!
estate/views/estate_list_views.xml
Outdated
| <field name="arch" type="xml"> | ||
| <list string="Properties"> | ||
| <field name="name"/> | ||
| <field name="tag_ids"/> |
There was a problem hiding this comment.
You could use widget="many2many_tags" to have the actual tag names displayed on each 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_property_type,access_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1 | ||
| estate.access_property_tag,access_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1 | ||
| estate.access_property_offer,access_property_offer,estate.model_estate_property_offer,base.group_user,1,1,1,1 No newline at end of file |
There was a problem hiding this comment.
No empty line at the end of file 😄
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "A table for estate properties types" |
There was a problem hiding this comment.
Nitpick: briefly explore the Odoo codebase searching for _descrption. You will see that we tend to use a more concise style. I would use something like "Estate Property Type".
e9bada5 to
f8501db
Compare
a2148ad to
c501952
Compare
AlessandroLupo
left a comment
There was a problem hiding this comment.
Good job with the git exercise! 👍
estate/views/estate_list_views.xml
Outdated
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Properties"> | ||
| <list string="Properties" decoration-success="state == 'offer_received' or state == 'offer_accepted'" decoration-bf="state == 'offer_accepted'" decoration-muted="state == 'sold'"> |
There was a problem hiding this comment.
You could also use decoration-success="state in ('offer_received', 'offer_accepted')"
There was a problem hiding this comment.
Try to search the Odoo codebase for the line _inherit = 'res.users'. You will see what is the common style for inherited classes. The class should be named "ResUsers" and the file should be named "res_users". ;)
1bfcf89 to
0338f3c
Compare
| from odoo import models | ||
|
|
||
|
|
||
| class EstatePropertyInherited(models.Model): |
There was a problem hiding this comment.
Nitpick: the conventional name here would be EstateProperty (no need to add "Inherited") ;)
0c0c697 to
9dda914
Compare
72594a6 to
f7ee509
Compare
awesome_owl/static/src/card/card.xml
Outdated
| <h5 class="card-title"><t t-esc="props.title"/></h5> | ||
| <p class="card-text"> | ||
| <t t-out="props.content"/> |
There was a problem hiding this comment.
You could also do:
<h5 class="card-title" t-out="props.title"/>
<p class="card-text" t-out="props.content"/>
| if (this.props.onChange) { | ||
| this.props.onChange(); | ||
| } |
There was a problem hiding this comment.
Here you could use optional chaining: this.props.onChange?.().
| } | ||
|
|
||
| addTodo(ev) { | ||
| if (ev.keyCode === 13 && ev.target.value != "") { |
There was a problem hiding this comment.
You could also use ev.key === "Enter" (see here). keyCode is deprecated
| static template = "awesome_owl.todo_list"; | ||
|
|
||
| setup() { | ||
| this.todos = useState([]); |
There was a problem hiding this comment.
Here I would do this.state = useState({todos: []}), and later access the todos array using this.state.todos, so it is clear that todos is in the component state.
AlessandroLupo
left a comment
There was a problem hiding this comment.
You're doing well! Just two comments
| static props = { | ||
| title: String, | ||
| content: String, | ||
| title: { type: String }, |
There was a problem hiding this comment.
Just to be clear, title: String was fine too (it is assumed implicitly that you are defining the type), but feel free to use the style you prefer 👍
| removeTodo = (todoId) => { | ||
| const index = this.todos.findIndex((t) => t.id === todoId); | ||
| if (index > 0) { | ||
| this.todos.splice(index, 1); | ||
| } | ||
| } |
There was a problem hiding this comment.
Will this work if we try to remove the first element in the todo list (index 0)?

No description provided.