-
Notifications
You must be signed in to change notification settings - Fork 2.9k
adding real estate module #1128
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?
Conversation
artn-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 job so far !
Just some small styling nitpicks, otherwise it's all good.
We try to always put a new line at the end of a file, this can be done automatically when you save your file in vscode if the Insert Final Newline option is activated.
estate/__manifest__.py
Outdated
| 'name': 'Estate', | ||
| 'version': '1.9', | ||
| 'category': 'Real Estate', | ||
| 'summary' : 'Manage your real estate properties', |
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.
Unwanted white space here
| 'summary' : 'Manage your real estate properties', | |
| 'summary': 'Manage your real estate properties', |
estate/models/estate_property.py
Outdated
| _name = 'estate.property' | ||
| _description = 'Estate Property' | ||
| name = fields.Char(string='Name', required=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.
Try to put the new line between the private attributes and the fields instead
| _name = 'estate.property' | |
| _description = 'Estate Property' | |
| name = fields.Char(string='Name', required=True) | |
| _name = 'estate.property' | |
| _description = 'Estate Property' | |
| name = fields.Char(string='Name', required=True) |
csan-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.
Great work! Just a few minor nitpicks
.gitignore
Outdated
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
| ruff.toml |
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.
make sure to always leave an empty line at the end of every file
estate/models/__init__.py
Outdated
| from . import ( | ||
| estate_property, | ||
| estate_property_offer, | ||
| estate_property_tag, | ||
| estate_property_type, | ||
| ) |
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.
nitpick
| from . import ( | |
| estate_property, | |
| estate_property_offer, | |
| estate_property_tag, | |
| estate_property_type, | |
| ) | |
| from . import estate_property | |
| from . import estate_property_offer | |
| from . import estate_property_tag | |
| from . import estate_property_type |
estate/models/estate_property.py
Outdated
| @api.depends("offer_ids.price") | ||
| def _compute_best_offer(self): | ||
| for record in self: | ||
| record.best_offer = max(record.offer_ids.mapped("price"), default=0) |
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.
Here, if there are no offers, it will break. It’s safer to handle that case explicitly. For example:
| record.best_offer = max(record.offer_ids.mapped("price"), default=0) | |
| record.best_offer = max(record.offer_ids.mapped("price")) if record.offer_ids else 0.0 |
estate/models/estate_property.py
Outdated
| def _onchange_garden(self): | ||
| if not self.garden: | ||
| self.garden_area = 0 | ||
| self.garden_orientation = "" |
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 fields usually expects either one of the predefined selection keys or False. Assigning an empty string could lead to inconsistent behaviours or validation errors.
| self.garden_orientation = "" | |
| self.garden_orientation = False |
| copy=False, | ||
| ) | ||
|
|
||
| @api.depends("validity") |
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.
| @api.depends("validity") | |
| @api.depends("create_date", "validity") |
| <field name="res_model">estate.property.tag</field> | ||
| <field name="view_mode">list,form</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 as above
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</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 as above
Add SQL constraints to ensure prices are positive and names are unique. Implement a Python constraint to prevent selling prices below 90% of the expected price.

No description provided.