-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[ADD] estate: created a new module #1021
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
Added a new module for estate property and completed tasks 1, 2, and 3. I added a models folder and learned to push data into PostgreSQL using ORM.
Enhanced the Security Logic for improved protection. Added the access control rights for the estate_property.py file
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!
I have left some comments.
For commit message you can refer this documentation :- https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html#commit-message-full-description
| @@ -0,0 +1,40 @@ | |||
|
|
|||
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.
unnecessary diff.
Estate/models/estate_property.py
Outdated
| copy=False, | ||
| default='new' | ||
| ) | ||
|
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.
An empty line should be without whitespace.
| name="List" | ||
| parent="estate_property_menu" | ||
| action="action_estate_property_list_only"/> | ||
|
|
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.
unnecessary diff.
Estate/views/estate_menus.xml
Outdated
| <menuitem id="estate_property_list_menu" | ||
| name="List" | ||
| parent="estate_property_menu" | ||
| action="action_estate_property_list_only"/> |
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.
| <menuitem id="estate_property_list_menu" | |
| name="List" | |
| parent="estate_property_menu" | |
| action="action_estate_property_list_only"/> | |
| <menuitem id="estate_property_list_menu" | |
| name="List" | |
| parent="estate_property_menu" | |
| action="action_estate_property_list_only"/> |
| <field name="view_id" ref="estate_property_form_view"/> | ||
| </record> | ||
|
|
||
|
|
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.
unnecessary diff.
| <separator/> | ||
| <filter name="group_by_postcode" | ||
| string="Group by 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.
Please check indentation.
| <menuitem id="estate_advertisement_menu" | ||
| name="Advertisements" | ||
| parent="estate_root_menu"/> | ||
| <menuitem id="estate_property_menu" | ||
| name="Properties" | ||
| parent="estate_advertisement_menu" | ||
| action="action_estate_property"/> |
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 below.
7f2ef3d to
d4f129f
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!
I have made another round of review
As we discussed early, can you please update your commit message title and please update your PR title and message?
Estate/models/estate_property.py
Outdated
| from odoo import models, fields, api | ||
| from datetime import timedelta |
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 odoo import models, fields, api | |
| from datetime import timedelta | |
| from datetime import timedelta | |
| from odoo import models, fields, api | |
Estate/models/estate_property.py
Outdated
| ("west", "West"), | ||
| ]) | ||
| active = fields.Boolean(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.
unnecessary diff.
Estate/models/estate_property.py
Outdated
| ("sold", "Sold"), | ||
| ("canceled", "Canceled"), | ||
| ], string="Status", required=True, copy=False, default="new") | ||
|
|
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.
unnecessary diff.
Estate/models/estate_property.py
Outdated
| salesperson_id = fields.Many2one("res.users", string="Salesperson") | ||
| tag_ids = fields.Many2many("estate.property.tag", string="Tags") | ||
| offer_ids = fields.One2many("estate.property.offer", "property_id", string="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 here.
Estate/models/estate_property.py
Outdated
| _check_expected_price = models.Constraint( | ||
| 'CHECK(expected_price < 0)', | ||
| 'The expected price of a property must be strictly positive.' | ||
| ) | ||
|
|
||
| _check_selling_price = models.Constraint( | ||
| 'CHECK(selling_price < 0)', | ||
| 'The selling price of a property must be positive.' | ||
| ) |
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.
Constraints should be defined after the field declaration. And is this your condition going to work properly ?. Have you checked it?
| <header> | ||
| <button name="action_set_next_status" string="Next" type="object"/> | ||
| <button name="action_back_to_new" string="Reset to New" type="object"/> | ||
| <button name="action_set_sold" string="Mark as Sold" type="object"/> | ||
| <button name="action_set_canceled" string="Cancel" type="object"/> | ||
| <field name="state" widget="statusbar" statusbar_visible="new,offer_received,offer_accepted,sold,canceled"/> | ||
| </header> |
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 outside of the sheet for better visibility. You can take reference from other Odoo apps.
Estate/models/estate_property.py
Outdated
| if record.selling_price < 0.9 * record.expected_price: | ||
| raise ValidationError("Selling price must be at least 90% of the expected price") | ||
| if record.expected_price < 0: | ||
| raise ValidationError("Expected price must be greater than 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.
We already have constrain, so do we need it here?
| _check_type_name_unique_ratio = models.Constraint( | ||
| 'CHECK(name)', | ||
| 'The property name must be unique.' | ||
| ) 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 end of the file.
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,
I think you have to adapt the changes that i suggest you. I have to make comment multiple times it is not good.
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection([("north", "North"),("south", "South"),("east", "East"),("west", "West"),]) | ||
| active = fields.Boolean(default=True) | ||
| state = fields.Selection([("new", "New"),("offer_received", "Offer Received"),("offer_accepted", "Offer Accepted"),("sold", "Sold"),("canceled", "Canceled")], required=True, copy=False , ) |
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.
| state = fields.Selection([("new", "New"),("offer_received", "Offer Received"),("offer_accepted", "Offer Accepted"),("sold", "Sold"),("canceled", "Canceled")], required=True, copy=False , ) | |
| state = fields.Selection( | |
| [ | |
| ("new", "New"), | |
| ("offer_received", "Offer Received"), | |
| ("offer_accepted", "Offer Accepted"), | |
| ("sold", "Sold"), | |
| ("canceled", "Canceled") | |
| ], required=True, copy=False) |
For better readability.
| total_area = fields.Float(compute="_compute_total_area", string="Total Area", store=True) | ||
| best_price = fields.Float(compute="_compute_best_price", string="Best Offer", store=True) | ||
| validity_days = fields.Integer(default=7) | ||
| date_deadline = fields.Date(compute="_compute_date_deadline",inverse="_inverse_date_deadline",store=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.
| date_deadline = fields.Date(compute="_compute_date_deadline",inverse="_inverse_date_deadline",store=True,) | |
| date_deadline = fields.Date(compute="_compute_date_deadline", inverse="_inverse_date_deadline", store=True,) |
Estate/models/estate_property.py
Outdated
| _check_price = models.Constraint( | ||
| 'CHECK(expected_price > 0 AND selling_price >= 0)', | ||
| 'The expected price of a property must be strictly positive.' | ||
| ) 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.
EOL missing.
| <field name="arch" type="xml"> | ||
| <form string="Property"> | ||
| <header> | ||
| <button name="action_set_next_status" string="Next" type="object"/> |
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 do not think that this button is necessary. As a user can not change the state manually every time.
Estate/models/estate_property.py
Outdated
| raise ValidationError("You cannot delete a new or canceled property.") | ||
| return super().unlink() | ||
|
|
||
| _check_price = models.Constraint( |
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 should be after field declaration, as I mentioned in the earlier comment.
| 'CHECK(name)', | ||
| 'The property name must be unique.' | ||
| ) | ||
|
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.
EOL missing.
| </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.
EOL missing.
| </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.
EOL missing.
| <field name="view_mode">form</field> | ||
| <field name="view_id" ref="view_users_form_inherit_properties"/> | ||
| </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.
EOL missing.
Introduced a new menu structure for the estate module, including a root menu and submenus for properties. Also added an action for managing estate properties with a corresponding view mode.
5efbebc to
a17e115
Compare
-added search view state field and list and form views [IMP] estate: Added list & form view -added filter for new or offer received stage [IMP] estate: Implemented models and views for property offers -added models and views for property offers field
… and types Implemented models and views for property offers tags and types
Enhanced property model and views with new fields and improved form layout
Implemented offer acceptance and refusal actions; added state management buttons in property views [FIX] estate: resolve Runbot style and linting errors (Ruff/Semgrep) This commit fixes all Runbot Check Style issues for the estate module. [FIX] estate: Cleaned up code by removing unnecessary blank lines in model files
-Refactored validity field to validity_days -added constraints for price validation
-Implemented inline views and widgets to enhance the user interface within the Real Estate module. -Introduced list-ordering functionality to improve the organization and sorting of listings. -Added attribute and option configurations to increase customization capabilities and overall flexibility for users.
-implemented inheritance in models,views -implemented some ui changes
5c1626e to
2343bb9
Compare

Created and configured the database for the Real Estate module, defining necessary fields such as property type, tags, buyer, salesperson, and offers. Implemented list, form, and search views with groupings, and added computed fields, inverse functions, and onchange functionalities. Included 'Sold' and 'Cancel' buttons with their corresponding functionality, as well as 'Accept' and 'Refuse' buttons with related logic.