-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ADD] Estate Module (Python Framework Training) #1068
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
barracudapps
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 comments here and there. Can you also please review your PR title and description following our guidelines (https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html)?
A clear commit message is really important to describe what you did and why you did it.
1911748 to
162d90a
Compare
162d90a to
bf9de48
Compare
…e Module. Improved UI to show all the details about each building
barracudapps
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.
Thanks for the feature. Here are some comments.
Avoid as much redundancy as possible, ease the searching and respect our naming conventions.
Let's take buildings_model.py as an example. The file is in the models folder of the estate module a better naming would have been building.py (or maybe estate_building.py as it allow a quick search on the module name and building.py might exist in many modules with different meanings).
Moreover, as it is a model the name should not be plural. Indeed, this is the template to create one building (multiple times but it's still 1 item).
Last thing here: please follow the instructions as if the task (tutorial) was written by a PO). You can of course challenge everything but I would've gone with a property instead of a building.
Also, can you please change the PR message and tell a bit more about what the added code is doing and why you added these lines?
…model. improved UX with compute and inverse methods
…l buttons to Buildings Model in Estate Module.
30aa8f1 to
2c0b30a
Compare
…s to the end of files. Improved the readability of manifest. renamed model classes to follow the pascal casing.
2c0b30a to
17ffc1d
Compare
barracudapps
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.
Very good for the PR message! 👍
Small comments and nits for the code but you're on tracks!
|
|
||
|
|
||
| class Building(models.Model): | ||
| _name = "estate.buildings" |
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 on your refactoring but still some small consistency issues like here (and the file names)
| _name = "estate.buildings" | |
| _name = 'estate.building' |
…ces must be positive. names, tags, and building types must be unique. Offer must be at least 90% of buildings value.
barracudapps
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.
Still some nits
| from odoo import models, fields, api | ||
| from odoo.exceptions import UserError | ||
| from datetime import timedelta | ||
| from odoo.tools.float_utils import float_compare |
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.
Nit here
| from odoo import models, fields, api | |
| from odoo.exceptions import UserError | |
| from datetime import timedelta | |
| from odoo.tools.float_utils import float_compare | |
| from datetime import timedelta | |
| from odoo import models, fields, api | |
| from odoo.exceptions import UserError | |
| from odoo.tools.float_utils import float_compare |
|
|
||
|
|
||
| class Offer(models.Model): | ||
| _name = "estate.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.
Same as for buildings, make it consistent
| _name = "estate.offers" | |
| _name = "estate.offer" |
| if record.status != "accepted" and record.building_id.state not in [ | ||
| "sold", | ||
| "canceled", | ||
| ]: |
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.
IMHO this is more readable
| if record.status != "accepted" and record.building_id.state not in [ | |
| "sold", | |
| "canceled", | |
| ]: | |
| if record.status != 'accepted' and record.building_id.state not in ['sold', 'canceled']: |
| raise UserError( | ||
| self.env._("Cannot accept offers for sold or canceled buildings.") | ||
| ) |
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.
| raise UserError( | |
| self.env._("Cannot accept offers for sold or canceled buildings.") | |
| ) | |
| raise UserError(self.env._("Cannot accept offers for sold or canceled buildings.")) |
| if ( | ||
| float_compare( | ||
| 0.9 * record.building_id.value, record.price, precision_digits=2 | ||
| ) | ||
| == 1 | ||
| ): |
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.
As we know float_compare returns either 1, 0 or -1 you can save some characters to keep the condition on a single line
| if ( | |
| float_compare( | |
| 0.9 * record.building_id.value, record.price, precision_digits=2 | |
| ) | |
| == 1 | |
| ): | |
| if float_compare(0.9 * record.building_id.value, record.price, precision_digits=2) > 0: |

[ADD] Implementation for Estate Module of Python Framework
Description:
This Pull Request introduces the Estate Module, which houses the new Estate FelBeit application. This application is designed to provide real estate agents with a centralized system for managing property listings, tracking the sales lifecycle, and handling the relationship between sellers and buyers.
Key Features: