Skip to content

[ADD] estate: add module to sell property#1187

Open
prsan-odoo wants to merge 17 commits intoodoo:19.0from
odoo-dev:19.0-tutorials-estate-prsan
Open

[ADD] estate: add module to sell property#1187
prsan-odoo wants to merge 17 commits intoodoo:19.0from
odoo-dev:19.0-tutorials-estate-prsan

Conversation

@prsan-odoo
Copy link
Copy Markdown

@prsan-odoo prsan-odoo commented Mar 10, 2026

-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.

@robodoo
Copy link
Copy Markdown

robodoo commented Mar 10, 2026

Pull request status dashboard

@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 506d60c to 42dea24 Compare March 10, 2026 13:29
@prsan-odoo prsan-odoo marked this pull request as ready for review March 13, 2026 04:03
Copy link
Copy Markdown

@bit-odoo bit-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/security/ir.model.access.csv Outdated
Comment thread estate/security/security.xml
Comment thread estate/__manifest__.py Outdated
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 2 times, most recently from 2ccf395 to 0bb3d15 Compare March 17, 2026 13:18
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 4 times, most recently from 7f6eb45 to 94858ce Compare March 25, 2026 04:38
Copy link
Copy Markdown

@bit-odoo bit-odoo left a 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 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

Comment thread estate/models/estate_property.py
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property.py Outdated
Comment thread estate/models/estate_property_offer.py
Comment thread estate/views/estate_property_views.xml Outdated
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from de1ab64 to b086120 Compare March 27, 2026 04:58
-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.
@prsan-odoo prsan-odoo changed the title [ADD] estate: set up real estate advertisement module(CH2,CH3 Done) [ADD] estate: add module to sell property Mar 27, 2026
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 4 times, most recently from 40f40c8 to 379a448 Compare March 27, 2026 06:47
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
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 379a448 to 61d8d94 Compare March 27, 2026 06:48
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).
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 61d8d94 to 20b113c Compare March 27, 2026 06:53
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 20b113c to 458dcb2 Compare March 27, 2026 06:56
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 458dcb2 to d244688 Compare March 27, 2026 07:00
…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).
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from d244688 to 75dfa75 Compare March 27, 2026 07:03
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 75dfa75 to f1b3862 Compare March 27, 2026 07:05
- 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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from f1b3862 to 042e840 Compare March 27, 2026 07:07
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
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 981db82 to aad1028 Compare April 1, 2026 04:30
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 9a28758 to b83de71 Compare April 2, 2026 04:58
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 2 times, most recently from d5b5474 to a08b21e Compare April 3, 2026 11:37
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 2 times, most recently from c264823 to 386d7bf Compare April 6, 2026 11:33
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
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 386d7bf to dda868e Compare April 6, 2026 11:51
Copy link
Copy Markdown

@bit-odoo bit-odoo left a 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 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):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user can direclty by pass the all rules and manually change the status.

Comment thread estate/models/estate_property_offer.py Outdated
# 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:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also clear the buyer_id.

self.status = 'refused'
return True

def create(self, vals_list):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def create(self, vals_list):
@api.model_create_multi
def create(self, vals_list):

Comment thread estate/models/estate_property_offer.py Outdated
self.property_id.state = 'sold'
return True

def action_refuse_offer(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 4 times, most recently from c4c4c37 to 42db13a Compare April 10, 2026 11:55
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.
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch 3 times, most recently from 5c2d959 to 277d9d9 Compare April 16, 2026 12:51
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
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from 277d9d9 to d759e83 Compare April 16, 2026 12:53
- 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
@prsan-odoo prsan-odoo force-pushed the 19.0-tutorials-estate-prsan branch from f9ffc2e to 3ec4516 Compare April 17, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants