-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[ADD] estate: init #1031
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?
[ADD] estate: init #1031
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.
Some nitpicks 😇
Keep up the good work 💪
estate/__manifest__.py
Outdated
| 'assets': { | ||
| }, |
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.
We don't have to declare the assets key if it is empty so you can remove it until you actually need it
estate/models/estate_property.py
Outdated
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Estate properties" | ||
| name = fields.Char('Property Name', required=True, translate=True) |
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.
Always have an empty line between the fields declaration and the class properties
estate/views/estate_menus.xml
Outdated
| <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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have an empty line by the end of every file
| </p> | ||
| </field> | ||
| </record> | ||
| </odoo> No newline at end of file |
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.
Same, empty line by the end of the file
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.
Nice work!!
Some comments to be taken into consideration!
estate/models/estate_property.py
Outdated
| garden_area = fields.Float('Garden Area (sqm)') | ||
| 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.
| selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]) | |
| selection=[ | |
| ('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west',` 'West') | |
| ]) |
Would be better for readability to have them in multiple lines
estate/models/estate_property.py
Outdated
| required=True, | ||
| default='new', | ||
| copy=False, | ||
| selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')]) |
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.
| selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')]) | |
| selection=[ | |
| ('new', 'New'), | |
| ('offer_received', 'Offer Received'), | |
| ('offer_accepted', 'Offer Accepted'), | |
| ('sold', 'Sold'), | |
| ('cancelled', 'Cancelled') | |
| ]) |
estate/models/estate_property.py
Outdated
| @api.depends('offer_ids.price') | ||
| def _compute_best_price(self): | ||
| for record in self: | ||
| record.best_price = max(record.offer_ids, key=lambda p: p.price).price |
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.
if the offer_ids recordset is empty it will trigger a ValueError so it is better to either check that offer_ids has something before we call max or we fallback on a default value
| record.best_price = max(record.offer_ids, key=lambda p: p.price).price | |
| record.best_price = max(record.offer_ids.mapped('price'), default=0.0) |
estate/models/estate_property.py
Outdated
| raise exceptions.UserError('Cancelled properties cannot be sold') | ||
| else: | ||
| record.state = 'sold' | ||
| return True No newline at end of file |
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.
missing EOL
|
|
||
| class EstatePropertyOffer(models.Model): | ||
| _name = "estate.property.offer" | ||
| _description = "Estate properties Offers" |
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.
Better to have the description here as title case
| _description = "Estate properties Offers" | |
| _description = "Estate Properties Offers" |
| <field name="name">estate.property.offer.list</field> | ||
| <field name="model">estate.property.offer</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Channel"> |
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.
| <list string="Channel"> | |
| <list string="Offers"> |
Would be reflecting better what is shown 😄
| <field name="facades" /> | ||
| <separator /> | ||
| <filter string="Available properties" name="available_properties" | ||
| domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" /> |
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.
| domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" /> | |
| domain="[('state', 'in', ('new', 'offer_received'))]"/> |
More precise
| <field name="name">estate.property.list</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Channel"> |
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.
| <list string="Channel"> | |
| <list string="Properties"> |
| </p> | ||
| </field> | ||
| </record> | ||
| </odoo> No newline at end of file |
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.
Missing EOL
| </list> | ||
| </field> | ||
| </record> | ||
| </odoo> No newline at end of file |
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.
Missing EOL

No description provided.