-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[ADD] estate: added the real estate module #362
base: 18.0
Are you sure you want to change the base?
Conversation
In this commit, I initialized the real estate module by setting up the essential configuration files, namely __manifest__.py and __init__.py.
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.
A few details.
estate/views/real_estate_views.xml
Outdated
@@ -0,0 +1,14 @@ | |||
<odoo> | |||
<!-- Define the action to open your module --> |
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 to add those comments. They add no value. We are just describing what we are doing which we can see by looking at the code.
estate/__manifest__.py
Outdated
@@ -0,0 +1,11 @@ | |||
{ | |||
'name': 'RealEstate', | |||
'version': '1.0.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.
'version': '1.0.0', | |
'version': '1.0', |
We use versions with 2 numbers.
estate/static/real_estate.png
Outdated
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 but not really useful in this contest.
estate/__manifest__.py
Outdated
{ | ||
'name': 'RealEstate', | ||
'version': '1.0.0', | ||
'author': 'Hicham', |
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.
'author': 'Hicham', | |
'author': 'Odoo S.A.', |
We work for Odoo S.A. 😄
@@ -0,0 +1,11 @@ | |||
{ |
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 licence ?
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.
Thank u for your feedback, I added a license field of type LGPL-3 which is convenient for our use case. Feel free to let me know if anything is not correct in my commits, I'll keep improving them commit after commit.
estate/models/constants.py
Outdated
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.
Why did you do it like this ? Where did the idea came from ?
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.
I did it this way to improve the readability of my code, I want to keep the constants always separated to avoid hard-coded values, I can follow the convention, and I think it will pay off once many models will be created in the future, I can modify some values in my models by only changing the constants.py file, I think it looks much cleaner rather than only hard-coding values and putting them as "raw_strings" inside of my estate_property.py file or any model that will be created in the future.
Open for any discussions or critics btw, you can let me know if this way of isolating parameters is not a good practice in odoo's philosophy and I'll change it in the next commits.
…removing the views folder I removed the views folder as long as it's not needed for now, I'll try to keep the folder structure well-adapted with each part of the tutorials. I changed some fields in my manifest file because they were not correct, the author field changed from my name 'Hicham' to 'Odoo S.A.', the version is '1.0' now rather than '1.0.0' as long as this is a small application and it's much convenient for it to have a short version. Moreover, I added a license field with the value LGPL-3 which is the Odoo license required for my module, my module is an open-source one therefore the LGPL-3 is convenient in this case.
Added the estate_property model to my real estate app, also I added a models/constants.py file that holds all the necessary data for my models to avoid hard-coded values in the future, as long as the project is evolving there will possibly be many constants added to it in the future.
added some constants values to the constants.py file, also I changed the name of some variables to align with the convention for each model I'll create in the future.
added the ir.model.access.csv inside of my security folder to add some access rules to the estate_property model. I gave the base.group_user the access to read, write, create and unlink.
Added the views folder to show some views for the app, for now it contains only one action and one menuitem. In addition to that I did some improvements to the app that are listed below: - added the following fields to my estate_property model -- name -- last_seen -- state -- active - removed the models/constants.py file and started using "raw_strings" instead as it looks much cleaner
Added a list to my estate property therefore I can see all the related fields to it in the UI. Added my estate property view form that contains a description notebook to see all the related fields to my estate property. Added my new estate filter that filters by the available fields q
- Added a list view to my real estate application to see all the estate properties - Added a form to my view to be able to create and edit records from the UI - Added a search component to filter by availability of a property and also to group by postcode
- Added a form to my views therefore I can create and edit properties from the UI - Added a search component to my views to be able to filter by the available properties (state either 'new' or 'offer_received') - Added the ability to group records by the postcode
Added the following models to my real estate application: - estate.property.offer - estate.property.tag - estate.property.type - estate.property Also I added views to each one of these models and added some menuitems.
…elds The following fields are added to my estate.property model: - total_area: living_area + garden_area - best_price: which is the maximum price in all the offers that are linked to a specific estate.property record, -> max_price([...estate.property.offers]) Also, the garden value is changed whenever the user checks the checkbox in the UI, the @api.onchange decorator is being used to listen on the onchange event of that field to set it accordingly, when it's toggled on the garden_area will be 10 and the garden_orientation will be 'north', otherwise if it's being toggled off, then the garden_area = 0 AND the garden_orientation is set to None In addition to that, the following fields are being added to my estate_property_offer model: - validity field which has a default value of 7 days - date_deadline which is create_date + validity An inverse function is added as well therefore the user can have the possibility to set either the date or the validity. Final update, I added a form, and some views to show the above updates in my models therefore the user can see those fields on the UI.
Added an action_do_something just to test out the RPC calls and how they work. The work is still in progress.
479107f
to
24dc361
Compare
I added some custom actions in the backend side, the offer now can be accepted, refused from the UI, one offer at a time can be accepted. also, the user now can undo the actions from the UI, if an offer has been 'refused' or 'accepted' the user can undo the operation, this feature will give much flexibility to the users of my application.
In the estate.property the following improvements have been added - the expected price should always be strictly positive (expected_price > 0) unless if the field is not set yet - the selling price will always be positve (selling_price >= 0) - bedrooms should never be negative (bedrooms >= 0) - living area will always be strictly positive (living_area > 0) - garden area will always be positive (garden_area >= 0) Also, when an offer will be accepted the selling price should not be less than 90% of the expected_price, the offer price should always satisfy this constraint to be considered a valid offer for our property.
Added a custom list of all the properties linked to one estate_property_type, the list is added to the estate_property_type's view.
…odel I added the statusbar widget to the view of estate_property model which will improve the UI of my application.
I added some ordering rules in my model level, this modification will allow my models to be sequenced following a specific ordering mechanism (desc by some fields, asc by some other fields ... etc)
Added some improvements to my UI in different views, now there are some colors being shown and some icons as well.
In this commit, I initialized the real estate module by setting up the essential configuration files, namely manifest.py and init.py.