[ADD] estate: add module to sell property#1187
[ADD] estate: add module to sell property#1187prsan-odoo wants to merge 17 commits intoodoo:19.0from
Conversation
506d60c to
42dea24
Compare
bit-odoo
left a comment
There was a problem hiding this comment.
Hello @prsan-odoo
Good Work!
I have added some comments.
Can you please follow the commit message guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html
Thanks
2ccf395 to
0bb3d15
Compare
7f6eb45 to
94858ce
Compare
bit-odoo
left a comment
There was a problem hiding this comment.
Hello,
Good Work!
Can you please update your commit message according to the guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/git_guidelines.html#commit-message-full-description
Also, can you please improve the PR title and PR description?
Thanks
de1ab64 to
b086120
Compare
-Created a new app called Estate. -Set up the estate addon with a proper manifest file. -Added estate property model with all required fields. -Access rights assigned to base groups. -CH2 , CH3 Completed.
40f40c8 to
379a448
Compare
The tutorial uses base groups, giving all rights to every user. Instead, Two dedicated groups are defined: - Agent: read and write access only - Manager: full CRUD access, implies Agent group - Admin user is automatically assigned the Manager group - CH4 Done
- Selling Price field is set as readonly so users cannot edit it manually; it is determined through the offer validation flow. - Selling Price and State fields are not duplicated when a property is copied, to avoid carrying over stale data. - Availability Date field is not duplicated so a fresh date is always required for new listings. - Bedrooms field defaults to 2 as a sensible starting point. - Active field defaults to True so properties are visible by default in list views. - State field is required and defaults to 'New' to track the property through its lifecycle. - CH5 done
379a448 to
61d8d94
Compare
Add basic UI views for the estate.property model to allow users to interact with property records. - Add list view to display properties in a tabular format. - Add form view to create, edit, and view individual properties. - Chapter 6 partially done (list and form views).
61d8d94 to
20b113c
Compare
Improve the estate.property views to make property browsing more efficient for users. - Add search view with filters for available properties and properties by current user. - Add group by postcode option in search view. - Apply domain filters on list and form views to refine displayed records. Chapter 6 completed.
20b113c to
458dcb2
Compare
The estate module needed relational fields to link properties to other records, demo data for easier development and testing, and an app logo for better identification in the app list. - Add Many2one fields for property type, buyer, and salesperson. - Add Many2many field for property tags. - Add One2many field for property offers. - Add demo data with 5 sample properties for testing. - Add app logo to identify the module in the app list. Chapter 7 completed.
458dcb2 to
d244688
Compare
…line Computed fields are needed to automatically calculate values that depend on other fields, avoiding manual input errors. - Add total area computed field combining living area and garden area. - Add best price computed field to show the highest offer received. - Add offer deadline computed field based on creation date and validity duration, with inverse to allow direct date editing. Chapter 8 partially done (computed fields only).
d244688 to
75dfa75
Compare
When a user enables the garden option, the garden area and orientation fields should be auto-filled with sensible defaults to reduce manual input. When disabled, both fields should be cleared to avoid stale data. - Add onchange method on garden field to set default garden area and orientation when garden is enabled. - Clear garden area and orientation when garden is disabled. Chapter 8 completed.
75dfa75 to
f1b3862
Compare
- Add optional hide on living area, seller, and buyer columns in list view to reduce visual clutter. - Add domain filters in search view to refine property results. - Set default search to show properties with offers received.
f1b3862 to
042e840
Compare
Without proper checks, offers can lead to incorrect property states and allow users to perform invalid actions. Added logic to manage offers so that properties follow the correct flow and only valid operations are performed. - Accepting an offer updates the selling price, buyer, and sets the state to offer accepted. - Other offers are automatically refused when one is accepted - Prevents accepting offers on sold or cancelled properties - Prevents refusing an already accepted offer - Deleting an accepted offer resets the property state and selling price - Added UserError validations to enforce business rules CH9 completed
981db82 to
aad1028
Compare
Without a default status, new offers had NULL in the database, causing an ambiguous state. Buttons were also visible on terminal states, leading to errors when clicked. - Add default 'pending' status on offers to avoid NULL values. - Add a computed field to hide action buttons when the offer status is already accepted or refused. - Make the status field read-only so it can only be changed via buttons.
9a28758 to
b83de71
Compare
Property state was not reflecting the actual offer situation. Creating an offer did not move the property out of 'new' state, and deleting the last offer left the property stuck in 'offer_received'. - Transition property to 'offer_received' when a new offer is added. - Reset property to 'new' when the last remaining offer is deleted. - Keep 'offer_received' if other offers still exist after deletion.
d5b5474 to
a08b21e
Compare
Invalid pricing entries such as negative amounts or selling prices far below the expected price can compromise data integrity and violate business rules. Constraints are needed to catch these errors before they reach the database. - Add SQL constraints to enforce strictly positive expected price and non-negative selling price at the database level. - Add Python constraint to ensure selling price is not lower than 90% of the expected price. Chapter 10 completed.
c264823 to
386d7bf
Compare
Improve the estate module UI by adding widget options, conditional field/button visibility, and a stat button on the property type form. - Prevent creating property types directly from the property form - Add color support to property tags - Hide garden fields when there is no garden - Show/hide offer buttons based on offer and property state - Add a stat button on property type showing the number of linked offers Chapter 11 completed
386d7bf to
dda868e
Compare
bit-odoo
left a comment
There was a problem hiding this comment.
Hello,
Can you please adapt your pr description?
Thanks
| start = record.create_date.date() if record.create_date else fields.Date.today() | ||
| record.validity = (record.date_deadline - start).days | ||
|
|
||
| def action_accept_offer(self): |
There was a problem hiding this comment.
We can also make the property status offer accepted here.
| <field name="state" | ||
| widget="statusbar" | ||
| statusbar_visible="new,offer_received,offer_accepted,sold,cancelled" | ||
| options="{'clickable': 'True'}" |
There was a problem hiding this comment.
The user can direclty by pass the all rules and manually change the status.
| # Check if ANY OTHER offers remain (excluding current) | ||
| remainaing_offers = offer.property_id.offer_ids.filtered( | ||
| lambda o: o.id != offer.id) | ||
| if not remainaing_offers: |
| self.status = 'refused' | ||
| return True | ||
|
|
||
| def create(self, vals_list): |
There was a problem hiding this comment.
| def create(self, vals_list): | |
| @api.model_create_multi | |
| def create(self, vals_list): |
| self.property_id.state = 'sold' | ||
| return True | ||
|
|
||
| def action_refuse_offer(self): |
There was a problem hiding this comment.
self.ensure_one(), you can use this since the method is triggered from a button on one offer.
You can also check the coding guidelines for it.
c4c4c37 to
42db13a
Compare
Without proper overrides, properties in active states could be deleted, offers with lower prices could be created, and there was no way to see a salesperson's properties directly from the user form. - Prevent deletion of properties that are not in 'new' or 'cancelled' state by overriding unlink. - Prevent creation of offers with a price lower than existing offers by overriding create on estate.property.offer. - Extend res.users model to add a One2many field linking a salesperson to their properties. - Add view inheritance on res.users form to display the list of properties linked to the salesperson. Chapter 12 completed.
5c2d959 to
277d9d9
Compare
Create a customer invoice automatically when a property gets marked as sold. The invoice includes: - 6% commission on the selling price - administrative fee This links the real estate module to accounting so property sales are recorded as invoices. Makes it easier to track finances. -Chapter 13 completed
277d9d9 to
d759e83
Compare
- Add kanban view with expected price, best price, selling price and tags - Show best price only when offer received, selling price when accepted - Group properties by type by default with drag and drop disabled Chapter 14 completed
f9ffc2e to
3ec4516
Compare

-Created a new app called Estate.
-Set up the estate addon with a proper manifest file.
-Added estate property model with all required fields.
-Access rights assigned to base groups.
-CH2 , CH3 Completed.