-
Notifications
You must be signed in to change notification settings - Fork 2.7k
19.0 tutorials taskv #1035
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?
19.0 tutorials taskv #1035
Conversation
yoba-odoo
left a comment
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.
Impressive work 👏
Just some small nitpicks. Would also be great if we can squash the FIX commits to their parent IMP commits so we can have a clean commit history.
Keep up the good work 👌
estate/__manifest__.py
Outdated
| """, | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
|
|
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.
No need for this empty line
estate/models/estate_property.py
Outdated
| active = fields.Boolean('Active', default=True) | ||
| description = fields.Text('Description') | ||
| postcode = fields.Char('Postcode') | ||
| date_availability = fields.Date('Available From', copy=False, default=fields.Datetime.now() + timedelta(days=90)) |
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('Available From', copy=False, default=fields.Datetime.now() + timedelta(days=90)) | |
| date_availability = fields.Date('Available From', copy=False, default=fields.Date.add(fields.Date.today(), months=3) |
What you are doing is correct as well but we have a helper in odoo to do the same so it is better to use it
estate/views/estate_menus.xml
Outdated
| id="properties_menu" | ||
| name="Properties" | ||
| parent="estate_menu_root" | ||
| action="estate.estate_property_action" |
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.
| action="estate.estate_property_action" | |
| action="estate_property_action" |
Since we are in the same folder as the action we don't have to use estate. to call the action it should be read automatically
estate/views/estate_menus.xml
Outdated
| id="properties_type_menu" | ||
| name="Property Types" | ||
| parent="settings_menu" | ||
| action="estate.estate_property_type_action" |
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.
| action="estate.estate_property_type_action" | |
| action="estate_property_type_action" |
Same
estate/views/estate_menus.xml
Outdated
| id="properties_tag_menu" | ||
| name="Property Tags" | ||
| parent="settings_menu" | ||
| action="estate.estate_property_tag_action" |
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.
| action="estate.estate_property_tag_action" | |
| action="estate_property_tag_action" |
Same
1490adf to
a786d01
Compare
a786d01 to
347453f
Compare
bab10bf to
d490741
Compare
3aa1cb8 to
220923d
Compare
e737a99 to
b722b3e
Compare
antonrom1
left a comment
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 job! Mostly small comments. Keep it going like this for JS next week :P
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
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.
The odoo license in every file is not needed anymore. You can remove it!
| 'demo': [ | ||
| ], |
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.
you don't need to specify demo if it's empty
| from . import estate_property | ||
| from . import estate_property_type | ||
| from . import estate_property_tag | ||
| from . import estate_property_offer | ||
| from . import res_users |
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.
You just need to sort all imports by alphabetical order like here
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#imports

| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
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.
Also you can remove that license, it's not needed anymore for any new odoo files
| garden_orientation = fields.Selection(string='Garden orientation', | ||
| selection=[('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West')] | ||
| ) |
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.
This indentation is a little bit strange, I would do something like this
| garden_orientation = fields.Selection(string='Garden orientation', | |
| selection=[('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west', 'West')] | |
| ) | |
| garden_orientation = fields.Selection( | |
| string='Garden orientation', | |
| selection=[ | |
| ('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west', 'West'), | |
| ], | |
| ) |
| if 'property_id' in vals and vals.get('property_id'): | ||
| current_property = self.env['estate.property'].browse(vals['property_id']) | ||
| if 'price' in vals and current_property.best_offer > vals.get('price', 0): | ||
| raise exceptions.ValidationError(f'The offer must be higher than {current_property.best_offer}') |
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.
Not a problem for the tutorial, but with an actual module, we usually don't use fstrings for errors, as you cannot translate these
Here is an example of how we usually format translated strings with parameters
https://github.com/odoo/odoo/blob/fc658b2e3d9c5afbfa5d00b579bf8928a90dab87/addons/barcodes/models/barcode_rule.py#L41
| @@ -0,0 +1,17 @@ | |||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | |||
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.
No need license
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form,kanban</field> | ||
| <field name="search_view_id" ref="estate_property_view_search"/> | ||
| <field name="context">{'search_default_filter_available':1}</field> |
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.
Keep the spacing consistent in XMLs too
| <field name="context">{'search_default_filter_available':1}</field> | |
| <field name="context">{'search_default_filter_available': 1}</field> |
| 'data': [ | ||
| ], | ||
| 'demo': [ | ||
| ], |
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.
Don't need to define these if no data or demo
|
|
||
| def action_property_sold(self): | ||
| invoice_vals_list = [] | ||
| for record in self: |
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.
In super().action_property_sold you call self.ensure_one(), and here you suppose that it's an iterable. You should pick one.

No description provided.