[ADD] estate: add real estate advertisement module#1230
[ADD] estate: add real estate advertisement module#1230vikvi-odoo wants to merge 15 commits intoodoo:19.0from
Conversation
c610728 to
cdb5287
Compare
bit-odoo
left a comment
There was a problem hiding this comment.
Hello @vikvi-odoo
You have written too many comments in the code.
Writing a comment is good, but no need to write a comments onevery single line. It's only required, like when there is a complex computation, etc.
Please use ruff for proper formatting.
Thanks
- Create the initial __manifest__.py file to define the module's metadata and make it discoverable by Odoo. - Add the __init__.py file to mark the directory as a Python package and prepare for importing future models and other components. - Establish the basic structure required for the new 'estate' module to be loaded and function within the Odoo framework.
- Updated the commit message to accurately reflect the changes made in the estate module for Chapter 2.
- fix the space issue in the __init__.py file of the estate module to ensure proper formatting and readability.
- Created estate.property model - Added module structure and manifest configuration - Implemented fields and basic validations - Fixed import and dependency issues - Resolved runtime errors during module loading [fix] estate: fix issue of external id and access rights [fix] estate: fix issue of access rights for estate.property model [fix] estate: fix issue of installation of estate module due to missing access rights
- Added ir.model.access.csv for estate.property - Configured basic CRUD permissions for internal users Chapter 4 - Security Intro
- Introduce the estate module into the user interface. - Add estate_menus.xml to define the module's menu structure and make it visible. - Include estate_property_views.xml to define the initial property views. - Implement the necessary extra fields and conditions as required by chapter 5.
- Removed superfluous comments that added noise without providing value. - Addressed inconsistent indentation to ensure adherence to code style guidelines.
- Addressed inconsistent indentation to ensure adherence to code style guidelines.
79e4560 to
e80d110
Compare
- Implement the list view for the estate properties. - Implement the form view for detailed property management. - Implement the search view to allow filtering and grouping of properties. - These views are introduced as part of the Chapter 6 exercises in the Odoo development tutorial.
Implement Many2one, Many2many, and One2many relationships: - Add Many2one link from property to property type - Add Many2many link between property and property tags - Add One2many link from property to offers - Update views to display the new relational fields
- The estate module's manifest was updated to include a proper description. - A standard LICENSE has been added . - These additions ensure the module is complete and adheres to standard Odoo module structure.
- Implement action_sold_property and action_cancel_property buttons. - Add validation to prevent cancelling a sold property and vice-versa. - Add action_accept_offer and action_reject_offer buttons in offer list. - Implement logic to automatically set selling_price and buyer upon offer acceptance. - Add UserError constraints to ensure data integrity during state transitions.
…t view - Add 'title' attribute to Accept and Reject buttons in the offer list view. - Resolve view validation error: "A button with icon attribute must have title".
… 10) - Add SQL constraints to ensure expected_price and offer price are strictly positive. - Add unique SQL constraints for property type and tag names to prevent duplicates. - Implement Python @api.constrains to enforce the "90% Rule": selling price cannot be lower than 90% of the expected price. - Use float_compare and float_is_zero tools for robust numerical validation.
-Clean up estate_property_offer.py by removing the ValidationError import which is no longer utilized in the current implementation.
bit-odoo
left a comment
There was a problem hiding this comment.
Hello,
I have added some comments.
Your code is not aligned with coding guidelines.
Please refer to the coding guidelines documentation.
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html
Also, can you please update your PR description, as it should be generic.
Thanks
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
|
|
| buyer = fields.Many2one('res.partner', copy=False) | ||
| offer_ids = fields.One2many('estate.property.offer', 'property_id') | ||
| active = fields.Boolean() | ||
|
|
| offer_ids = fields.One2many('estate.property.offer', 'property_id') | ||
| active = fields.Boolean() | ||
|
|
||
| total = fields.Integer(compute='_compute_totalArea') |
There was a problem hiding this comment.
| total = fields.Integer(compute='_compute_totalArea') | |
| total_area = fields.Integer(compute='_compute_total_area') |
| @api.depends('living_area', 'garden_area') | ||
| def _compute_totalArea(self): | ||
| for record in self: | ||
| record.total = record.garden_area + record.living_area | ||
|
|
||
| @api.depends('offer_ids.price') | ||
| def _compute_best_price(self): | ||
| for record in self: | ||
| prices = record.offer_ids.mapped('price') | ||
|
|
||
| if prices: | ||
| record.best_price = max(prices) | ||
| else: | ||
| record.best_price = 0 | ||
|
|
||
| @api.onchange('garden') | ||
| def _onchange_garden(self): | ||
| if self.garden: | ||
| self.garden_area = 10 | ||
| self.garden_orientation = "north" | ||
| else: | ||
| self.garden_area = 0 | ||
| self.garden_orientation = "" | ||
|
|
||
| def action_sold_property(self): | ||
| if self.state == 'cancelled': | ||
| raise UserError("A cancelled property cannot be set as sold.") | ||
| return False | ||
|
|
||
| self.state = 'sold' | ||
| return True | ||
|
|
||
| def action_cancel_property(self): | ||
| if self.state == 'sold': | ||
| raise UserError("A sold property cannot be set as cancelled.") | ||
|
|
||
| self.state = 'cancelled' | ||
| return True | ||
|
|
||
| _check_positive = models.Constraint( | ||
| 'check(expected_price > 0 )', | ||
| 'Expected price must be positive' | ||
| ) |
There was a problem hiding this comment.
Can you followe the coding guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#symbols-and-conventions
| if record.status == 'accepted': | ||
| raise UserError('Offer is already accepted') | ||
| return False | ||
|
|
| if self.status == 'accepted': | ||
| self.status = 'refused' | ||
| self.property_id.selling_price = 0 | ||
| self.property_id.buyer = "" | ||
| else: | ||
| raise UserError('The offer you are refusing is not the accepted one') |
There was a problem hiding this comment.
Why do you add a check that to refuse the offer, we have to first accept it?
|
|
||
| def action_cancel_property(self): | ||
| if self.state == 'sold': | ||
| raise UserError("A sold property cannot be set as cancelled.") |
There was a problem hiding this comment.
It is good if we make the error message translatable.
raise UserError(_("A sold property cannot be set as cancelled."))
| class EstatePropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Estate Property Tag" | ||
| name = fields.Char(required=True) |
| </list> | ||
| </field> | ||
| </record> | ||
| <record id="estate_property_form" model="ir.ui.view"> |
There was a problem hiding this comment.
should be one empty line before it. You can refer to the coding guidelines documentation.
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#xml-files

Add a new real estate advertisement module that allows
users to manage property listings. The module includes
the data model, security access rights, and the basic
UI to navigate and interact with property records.
Chapter-2 to Chapter-5