-
Couldn't load subscription status.
- Fork 2.6k
[ADD] estate: created a new module #1013
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
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.
Hello,
Nice work!
I have added some comments please have a look at it.
module name is estate not real_estate.you can addapt it in commit message title.
For commit message you can refer this documentation :- https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html#commit-message-full-description
estate/__init__.py
Outdated
| @@ -0,0 +1 @@ | |||
| from . import models 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.
There is a missing "blank" line at the end of the file.
estate/models/__init__.py
Outdated
| @@ -0,0 +1 @@ | |||
| from . import estate_property 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.
There is a missing "blank" line at the end of the file.
estate/models/estate_property.py
Outdated
| selection=[('north', 'North'),('south', 'South'),('east', 'East'),('west', 'West')], | ||
| string="Garden Orientation" | ||
| ) | ||
| active = fields.Boolean(string="Active", default=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.
There is a missing "blank" line at the end of the file.
estate/models/estate_property.py
Outdated
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
|
|
||
| name = fields.Char(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.
It will throw an error. It takes a boolean value. Test your code before pushing it to GitHub.
| name = fields.Char(required='True') | |
| name = fields.Char(required=True) |
estate/models/estate_property.py
Outdated
| from odoo import models,fields | ||
|
|
||
| class estateproperty(models.Model): |
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.
Leave two lines between import and classes for better readability.
estate/__manifest__.py
Outdated
| 'data': ['security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_menus.xml' |
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.
| 'data': ['security/ir.model.access.csv', | |
| 'views/estate_property_views.xml', | |
| 'views/estate_menus.xml' | |
| 'data': [ | |
| 'security/ir.model.access.csv', | |
| 'views/estate_property_views.xml', | |
| 'views/estate_menus.xml' |
estate/security/ir.model.access.csv
Outdated
| @@ -0,0 +1,2 @@ | |||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | |||
| estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 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.
There is a missing "blank" line at the end of the file.
estate/views/estate_menus.xml
Outdated
| <menuitem id="menu_estate_property_action" action="action_estate_property" /> | ||
| </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.
There is a missing "blank" line at the end of the 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.
There is a missing "blank" line at the end of the file.
Added a new 'real estate' module, created the database, and defined necessary columns.
Set default values for fields, added new field attributes, and created menus for accessing default list and form views in Real Estate 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.
I have added some comments.
estate/models/estate_property.py
Outdated
| description = fields.Text(string="Description") | ||
| postcode = fields.Char(string="Postcode") | ||
| date_availability = fields.Date(string="Availability Date", default=fields.Date.today()+relativedelta(months=3)) | ||
| expected_price = fields.Float(string="Expected Price", required=True) | ||
| selling_price = fields.Float(string="Selling Price", readonly=True) | ||
| bedrooms = fields.Integer(string="Bedrooms", default=2) | ||
| living_area = fields.Integer(string="Living Area (sqm)") | ||
| facades = fields.Integer(string="Facades") | ||
| garage = fields.Boolean(string="Garage") | ||
| garden = fields.Boolean(string="Garden") | ||
| garden_area = fields.Integer(string="Garden Area (sqm)") | ||
| garden_orientation = fields.Selection( | ||
| selection=[ | ||
| ("north", "North"), | ||
| ("south", "South"), | ||
| ("east", "East"), | ||
| ("west", "West"), | ||
| ], | ||
| string="Garden Orientation", | ||
| ) | ||
| state = fields.Selection( | ||
| [ | ||
| ("new", "New"), | ||
| ("offer_received", "Offer Received"), | ||
| ("offer_accepted", "Offer Accepted"), | ||
| ("sold", "Sold"), | ||
| ("cancelled", "Cancelled"), | ||
| ], | ||
| string="Status", | ||
| required=True, | ||
| copy=False, | ||
| default="new", | ||
| ) | ||
| active = fields.Boolean(string="Active", default=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.
By default odoo generate string. If your string is same as technical name, then no need to add.
| from dateutil.relativedelta import relativedelta | ||
|
|
||
| class estateproperty(models.Model): |
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.
Leave two lines between import and classes for better readability.
Created list, form, and search views, and added group by functionality in the Real Estate.
51d5d60 to
7eb4493
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.
Hello, nice work!
Please use this documentation:- https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html#commit-message-full-description
do not push commit like "WIP", and make sure that your runbot is green.
| from dateutil.relativedelta import relativedelta | ||
|
|
||
|
|
||
| class estateproperty(models.Model): |
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.
Class name should be in camel case 'EstateProperty`.
| description = fields.Text("Description") | ||
| postcode = fields.Char("Postcode") | ||
| date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3)) | ||
| expected_price = fields.Float("Expected Price", required=True) | ||
| selling_price = fields.Float("Selling Price", readonly=True) | ||
| bedrooms = fields.Integer("Bedrooms", default=2) | ||
| living_area = fields.Integer("Living Area (sqm)") | ||
| facades = fields.Integer("Facades") | ||
| garage = fields.Boolean("Garage") | ||
| garden = fields.Boolean("Garden") | ||
| garden_area = fields.Integer("Garden Area (sqm)") |
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 adapt these changes that were suggested to you earlier. You don't have to write a string if it's the same as the technical name.
#1013 (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.
One empty line is sufficient.
| name = fields.Char(required=True) | ||
| description = fields.Text("Description") | ||
| postcode = fields.Char("Postcode") | ||
| date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3)) |
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.
| date_availability = fields.Date("Availability Date", default=fields.Date.today()+relativedelta(months=3)) | |
| date_availability = fields.Date("Availability Date", default=fields.Date.today() + relativedelta(months=3)) |

Added a new 'real estate' module, created the database, and defined necessary columns.