-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[ADD] Real estate application #1132
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
ac904f3 to
de075ba
Compare
- Created the estate module. - Created the EstateProperty model.
de075ba to
ff5d6b3
Compare
- Remvoed pylint error-ingoring commands. - Added Ruff config file for style check. - Reformated some files.
- Added security configuration for the estate module. - Fixes the warning message about the access rules.
- Added a simple test action to the estate module.
e3002a3 to
a2089f1
Compare
plha-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 for the overall quality of the code and syntax.
congrats on using the correct convention for the commit titles.
a few small comments :
- We try to always leave an empty line at the end of every file.
If you are using vscode there is an option to automatically do it which is called Insert Final Newline. - make sure to add your ruff.toml file in a gitignore file so it's not pushed on your branch
estate/models/estate_property.py
Outdated
| from datetime import date | ||
|
|
||
| from dateutil.relativedelta import relativedelta |
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 blank lines between related imports
| from datetime import date | |
| from dateutil.relativedelta import relativedelta | |
| from datetime import date | |
| from dateutil.relativedelta import relativedelta |
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.
Changed!
Set up the general user interface for the estate app/module. - Added estate menu - Added action window - Set up the fields properties (required, default, etc..) - Added the `active` reserved field to the view
fdca6dc to
3f06a7a
Compare
Adds three more views to the `estate` model:
- `list`: allows the display of the records in a tabular form.
- `form`: allows the create/edit of the record in a more sturctured way.
- `search`: allows the search for records using filters, and grouping the results
by some chosen fields.
- We also defined a default filter: `Available`, which filters the results
by `state = New` or `state = Offer Received`.
Also adds some refactoring to align with the coding guidelines (new line, import
order, etc..).
Added three more features for the real estate: `type`, `tag`, and `offers`.
- A property can have one type, and a type can be assigned to multiple
properties.
- A property can have multiple tags, and each tag can be assinged to
multiple properties.
- A property can have multiple offers, and an offer can be assigned to
multiple properties.
In addition to the `fields.One2many('estate.property.offer')` defined in the `estate.property`
model, we had to add `fields.Many2one('estate.property')` in the `estate,property.offer`,
because the `One2many` is a virtual relationship.
plha-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.
good job on applying the correct title convention for the last commits
a few comments:
- don't forget to add your ruff.toml file in a gitignore file
| 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.
| 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 |
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.
Actually, when I run:
ruff check estate/models/__init__.py --fix --config ruff.tomlruff automatically reformats it that way.
Should I change the ruff.toml file ?
estate/models/estate_property.py
Outdated
| from datetime import date | ||
|
|
||
| from dateutil.relativedelta import relativedelta |
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.
| from datetime import date | |
| from dateutil.relativedelta import relativedelta | |
| from datetime import date | |
| from dateutil.relativedelta import relativedelta |
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 this comment, ruff automatically formats it like that.
Maybe I'm using the wrong ruff.toml file ?
estate/models/estate_property.py
Outdated
| from datetime import date | ||
|
|
||
| from dateutil.relativedelta import relativedelta |
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.
| from datetime import date | |
| from dateutil.relativedelta import relativedelta | |
| from datetime import date | |
| from dateutil.relativedelta import relativedelta |
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.
Please see comment.
estate/models/estate_property.py
Outdated
| # res.users: the users of the system. Users can be 'internal', i.e. they have access to the Odoo backend. Or they can be | ||
| # 'portal', i.e. they cannot access the backend, only the frontend (e.g. to access their previous orders in eCommerce). |
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 try to add explication comment only when really needed (because of tricky behaviour for instance)
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're right, I just wanted to add them for reference for later (when I get back the PR in the future).
I removed them.
estate/models/estate_property.py
Outdated
| # res.users: the users of the system. Users can be 'internal', i.e. they have access to the Odoo backend. Or they can be | ||
| # 'portal', i.e. they cannot access the backend, only the frontend (e.g. to access their previous orders in eCommerce). | ||
| sales_person_id = fields.Many2one('res.users', string='Salesman', index=True, default=lambda self: self.env.user) | ||
| # res.partner: a partner is a physical or legal entity. It can be a company, an individual or even a contact address. |
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 here
| copy=False, | ||
| ) | ||
| partner_id = fields.Many2one('res.partner', required=True) | ||
| # Because a One2many is a virtual relationship, there must be a Many2one field defined in the comodel. |
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 here
| # Because a One2many is a virtual relationship, there must be a Many2one field defined in the comodel. |
Adds computed fields such as the `total area`. The `validity` can also be updated automatically when the `total_area` is explicitly set. Adds `onchange` listeners to update the offer form's fields `Garden Area` and `Garden Orientation` automatically when the `Garden` field is set. When the latter field is set, the `Garden Area` is given a default value of 10, and the `Garden Orientation` is set to North.
4b52e5d to
6754e8f
Compare
Adds `accept` and `cancel` buttons to the property form, and links them to the correct python methods (actions). When an offer is accepted, the property's buyer info, as well as the selling price are automatically updated.
Adds constraints on field `expected_price`, tag names, type names, and the minimum offer price accpeted (calculated based on the expected price). Some constraints are defined using plain SQL, and others using the python's `@api.constrains`.
Adds the `title` attribute to the `button` tag. Fixes the error: A button with icon attribute (fa-check) must have title in its tag, parents, descendants or have text.

EstatePropertymodel.