-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[IMP] Estate: Enhance property management with relations, views, and access #1108
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
Add estate module Configure custom module structure in Odoo 19 Introduce addons structure and ORM models Define database tables using Odoo ORM CHAPTER 1,2,3
Define model access rules for the estate module using ir.model.access.csv to control user permissions. CHAPTER 4
Make estate.property accessible from the UI with proper defaults and field constraints.
CHAPTER 5
bit-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.
Hello, Good Job!
i have added some comments.
no need to do separate commit for this - 3981aa4
Can you please adapt the PR meesage and title accroding to guidelines.
Thanks
estate/__manifest__.py
Outdated
| @@ -0,0 +1,15 @@ | |||
| { | |||
| 'name': "Real Estate", | |||
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 follow the same quote throughout the file.
estate/models/estate_property.py
Outdated
| from odoo import fields, models | ||
| 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.
Can you please follow these guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#imports
estate/models/estate_property.py
Outdated
| garage = fields.Boolean() | ||
| garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
|
|
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.
unneccary diff.
estate/models/estate_property.py
Outdated
| garden_orientation = fields.Selection( | ||
| [('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')] | ||
| ) | ||
|
|
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.
unneccary diff.
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 | |||
| access_estate_property,access_estate_property,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.
Should be one empty line at the EOF.
estate/views/estate_menus.xml
Outdated
| </menuitem> | ||
|
|
||
| </data> | ||
| </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.
Should be one empty line at the EOF.
estate/views/estate_menus.xml
Outdated
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <data> | ||
|
|
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.
unneccary diff.
estate/views/estate_menus.xml
Outdated
| <menuitem id="estate_properties_menu_action" action="estate_property_action"/> | ||
| </menuitem> | ||
| </menuitem> | ||
|
|
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.
unneccary diff.
| <field name="res_model">estate.property</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.
Should be one empty line at the EOF.
Improve estate.property usability by organizing fields and adding filters. CHAPTER 6
Improve data link between related models. CHAPTER 7
|
Changes have been made as per the review suggestions. Thank you. |
bit-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.
Hello,
Good Work!
Can you please improve all your commit message accroding to guidelines.
Thanks
estate/models/estate_property.py
Outdated
| from dateutil.relativedelta import relativedelta | ||
| from odoo import fields, models |
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 do not make the same mistake repeatedly. #1108 (comment)
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="garden" /> | ||
| <field name="garage" /> | ||
| <field name="date_availability" /> |
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 can make some fields optional for better visibility.
| <separator /> | ||
| <filter string="Available" name="active" domain="[('state', 'in', ['new','offer_received'])]" /> | ||
| <filter string="postcode" name="postcode" context="{'group_by':'postcode'}" /> | ||
|
|
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.
unneccary space.
- Add computed fields for total area and best offer to ensure data consistency - Implement computed validity date with inverse logic on property offers - Add onchange to assist garden-related form inputs without business logic CHAPTER - 8
- Add Cancel and Sold actions on properties with state validation - Add Accept and Refuse actions on offers with business constraints - Ensure accepted offer sets buyer and selling price, enforcing uniqueness CHAPTER - 9
- Add SQL constraints for positive prices and unique names - Add Python constraint to block selling below 90% expected price - Ensure constraints trigger on expected and selling price changes CHAPTER 10
- Add inline list view on property type to show linked properties - Display property state using statusbar widget for better clarity - Improve UX by simplifying views without changing business logic CHAPTER 11
- Improve usability by adding inline list views and statusbar widgets - Prevent invalid actions using conditional visibility and readonly rules - Enhance readability with list decorations, tag colors, and editable lists - Apply deterministic and manual ordering, plus better default search behavior CHAPTER 11
bit-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.
Hello,
Can you please improve your PR message and title.
Thanks.
| def action_sold(self): | ||
| for record in self: | ||
| if record.state == 'cancelled': | ||
| raise exceptions.UserError("Cancelled properties cannot be sold.") | ||
| record.state = 'sold' | ||
| return 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's good to make the error message translatable.
raise exceptions.UserError(_("Cancelled properties cannot be sold."))
We can use filtered() here.
if self.filtered(lamda x: x.state=="cancelled")
| for record in self: | ||
| if record.state == 'sold': | ||
| raise exceptions.UserError("Sold properties cannot be cancelled.") | ||
| record.state = 'cancelled' |
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's good to make the error message translatable.
raise exceptions.UserError(_("Sold properties cannot be cancelled."))
We can use filtered() here.
if self.filtered(lamda x: x.state=="sold")

Completed chapters 1-5 of the Odoo tutorial, including basic app creation, models, security, and UI setup.