Skip to content
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

[ADD] estate: add model, view and security #328

Draft
wants to merge 12 commits into
base: 18.0
Choose a base branch
from

Conversation

sabj-odoo
Copy link

@sabj-odoo sabj-odoo commented Feb 6, 2025

This module was built as part of a technical training to explore Odoo's multi-tier architecture and the structure of a module. It covers the use of business objects, views, and data files (XML & CSV) in a real-world scenario.

which includes:
User-friendly Views & Menus – Includes form, list, and search views with intuitive navigation.
Access Control – Implements model-level permissions (read, write, create, delete) via ir.model.access.csv.
Property Management – Allows adding and managing properties with types and tags.
User Roles – Assigns properties to a salesperson (Odoo user) and a buyer (res.partner).

@robodoo
Copy link

robodoo commented Feb 6, 2025

Pull request status dashboard

@sabj-odoo sabj-odoo changed the title test [ADD] estate: add model, view and security Feb 6, 2025
Day 1:
chapter 1:-  Architecture Overview
                        --Presentation tier
                        --Logic tier
                        --Data tier

chapter 2:- Create a estate module

Day 2 :
Chapter 3 :- Add estate_property file  in the models folder in which i added
various properties like name, description, price, living area.

chapter 4:- Add security to our model.

chapter 5 :- I load our first action and menus through an XML file.
estate/__manifest__.py Outdated Show resolved Hide resolved
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

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

Please let me know once the comments are resolved :)

@maad-odoo
Copy link

Also PR message is missing. Please add one

- Added custom search view for properties based on:
  - Property name
  - Postcode
  - Expected price
  - Bedrooms
  - Living area
  - Facades
- Implemented a custom filter for property availability.
- Introduced a custom 'Group By' option based on postcode.
- Improved the list and form views for better usability.

This update enhances the user experience by providing better search ability,
filtering, and organization of property records.
Day 4:

- Implemented relationships between models in the estate module. Added the
`estate.property.type` model with corresponding menu, action, and views.

- Introduced estate.property.tag with a `Many2many` relationship to properties
and updated the form and list views with tag selection.

- Created the estate.property.offer model with a `One2many` relationship to
properties, allowing multiple offers per property.

- Enhanced property form to display related offers, tags, and type selection.
Day 5:

- Added computed fields total_area and best_price, with an inverse method for
date_deadline.
- Implemented onChanges for garden properties and property state transitions
(sold/canceled).
- Automatically set selling_price and buyer when an offer is accepted.
- Applied SQL constraints for positive prices and unique names for tags and
types.
- Enhanced UI with color coding, button visibility updates, and default sorting
across models.
- Enforced a Python constraint to ensure selling_price ≥ 90% of expected_price.
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

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

A quick review

estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property_offer.py Outdated Show resolved Hide resolved
estate/views/estate_property_offer_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_offer_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_tag_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_type_views.xml Outdated Show resolved Hide resolved
estate/views/estate_property_views.xml Outdated Show resolved Hide resolved
Day 6:

- Added color decorations for properties and offers in list views.
- Hide `date_availability` field by default in `estate.property` list view.
- Used `invisible` attribute to conditionally hide:
   - Garden fields when `garden` is False.
   - 'Accept' and 'Refuse' buttons after an offer state is set.
- Prevented adding offers when the property is in 'Offer Accepted,' 'Sold,'
or 'Cancelled' states (readonly attribute).
- Implemented inline list view for `estate.property.type` showing limited fields.
- Prevented creation/editing of `property_type_id` from property form view.
- Added color picker for `estate.property.tag` using `color` field.
- Used `invisible` attribute to hide 'Sold' and 'Cancel' buttons when property
 is sold or cancelled.
Copy link

@maad-odoo maad-odoo left a comment

Choose a reason for hiding this comment

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

Hii 👋

Added few more comments

estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property.py Outdated Show resolved Hide resolved
estate/models/estate_property_offer.py Outdated Show resolved Hide resolved
Day 7:

- Implemented auto-sequencing for estate properties.
- Colored offer list view:
  - Refused offers appear in red.
  - Accepted offers appear in green.
  - Removed state field from the list view.
- Added default filter: 'Available' selected by default.
- Enhanced living area search: now finds properties with area >= input.
- Added stat button on property type form to show related offers.
Day 8:

- Implemented Python inheritance, model inheritance and view inheritance.
- Prevented deletion of properties unless they are 'New' or 'Cancelled'.
- Extended the `res.users` model to display linked properties.
- Added a `property_ids` One2many field to show salesperson's properties.
- Created `estate_account` module for invoicing integration.
- Added a Kanban view for properties.
- Grouped properties by type and disabled drag & drop.
Day 9:

- Added security groups: estate_group_user (Agent) and estate_group_manager
(Manager) with proper hierarchy.
- Updated access rights: Managers have full control, agents have restricted
access, and no user can delete properties.
- Implemented record rules: Agents can only view and modify their own
properties, while managers have full visibility.
- Allowed agents to confirm sales without full invoicing access using a
controlled security bypass.
- Introduced company_id for estate properties to support multi-company setups.
- Limited access to the Settings menu for agents.
Day 10:

- Added demo data for properties with all relevant fields.
- Added report in pdf format.
- create a button on UI for printing pdf.
- read `reuse code with mixins`.
- add chatter in the ui.
- read `Qweb templates` and `web controller`.
Day 11:

-add invoicing information by inheriting the estate_report in estate module to
estate_account module.
-add unit tests to check no one create an offer for a sold property and sell a
property with no accepted offers to it.
-add unit test to make sure that garden area and orientation resets back without
breaking.
Day 11:

-add counter component to display.
-extract counter component in a sub component.
-add card component.
-add markup to display html.
-add props validation.
-add sum of two counter components.
Day 12:

-add todo list
    -add dynamic attributes to mute and line-through tasks which are done.
    -add todo function.
    -add custom hook useAutoFocus to focus input.
    -add toggle todo and delete todo function.
- add delete todo list items functionality.
-add generic card with slots.
-add toggle in card to minimize card content.
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