Skip to content

[ADD] estate, awesome_dashboard, awesome_owl: tutorial chapters #852

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

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

Conversation

dhtr-odoo
Copy link

@dhtr-odoo dhtr-odoo commented Jul 11, 2025

This pull request includes work done across three modules , estate, awesome_dashboard, and awesome_owl

estate module

  • Set up One2many and Many2one relationships between properties and offers
  • Added computed fields like best offer and total area
  • Implemented onchange behavior for garden logic
  • Added action buttons to accept/refuse offers and mark properties as sold or cancelled
  • Added SQL and Python constraints:
    • Price validations
    • Selling price must be at least 90% of expected price
  • Buyer and selling price are now auto-assigned when an offer is accepted
  • Offers are displayed with clickable accept/refuse icons in list view

awesome_dashboard module

  • Created a PieChart component using OWL
  • Used OWL lifecycle hooks like onMounted, useRef, and loadJS
  • Component is designed to be modular and clean
  • Followed the service pattern to handle dialog-based interactions

awesome_owl module

  • TodoList + TodoItem components with:
  • Add/Delete/Toggle task
  • Auto-focus with useRef, onMounted

dhtr-odoo added 15 commits June 20, 2025 10:16
This commit initializes the estate module with base setup:
- `__init__.py` and `__manifest__.py`
- Core model: `estate.property`
- Basic model structure and folder layout
Set up the foundational structure of the `estate` module to enable property management workflows. This setup ensures the module is installable and functional from the start with essential views, menus,action controls
Improves the estate property form with:
- Tabs using <notebook> for Description and Sales info
- many2many_tags widget for Tags

Adds corresponding menu items and actions under a new Settings section.
Reordered XML files in  to ensure  is loaded before any views referencing it.\n\nPreviously,  referred to  before it was defined in , causing:\n  External ID not found in the system: estate.estate_menu_settings\n\nThis update prevents that error by ensuring menu definitions are loaded first.
…elds, view

This update covers Chapters 11 and 12 of the official Server Framework 101 tutorial:

Added stat button to estate.property.type to show related offers
- Introduced `property_type_id` related field on estate.property.offer
- Computed `offer_count` on estate.property.type
- Linked the stat button to open the offer tree view with filtered domain

Inherited res.users to add property_ids field
- Added a new Many2many relationship between users and properties
- Created a notebook page in `base.view_users_form` using view inheritance
- Extended the view cleanly via `inherit_id` and XPath logic

Improved offer creation logic for batch safety
- Replaced `@api.model` with `@api.model_create_multi` in `create()` method
- Handled list of vals dicts and avoided duplicate state setting
- Prevented offer creation with price lower than the current highest offer
- Implemented access control (record rules + ir.model.access.csv)
- Added master data for property types using CSV
- Defined demo data for properties and offers using XML
- Used `eval` for dynamic values like availability and deadline dates
- Used `ref` to link partners and properties in offers
- Created inline One2many demo offers using `Command.create()`
- Ensured offers respect existing business constraints via computed/inverse fields
- Created sub-template 'report_offer_table_template' for rendering property offers
- Added salesman report 'report_estate_salesman_offer_document' bound to res.users
- Ensured proper use of t-if/t-else to avoid QWeb rendering errors
- Prepared base template structure for extension in estate_account (e.g. invoice info for sold properties)
This commit adds transaction-based unit tests  in the estate module
…ange prop

This commit adds a reusable Counter component to the awesome_owl module using OWL.
- Maintains internal reactive state using `useState`
- Increments count on button click
- Accepts an optional `onChange` callback prop to notify parent components of state updates
…sed layout

Added a new Owl-based dashboard to the awesome_dashboard module.
- Implemented the main `AwesomeDashboard` client action using the standard Layout component.
- Added control buttons at the top for quick access to Customers and Leads.
- Displayed key statistics (new orders, total amount, average quantity, etc.) using styled dashboard cards.
- A new statistics service using `memoize()` to avoid repeated RPC calls , data is fetched once and reused.
…rable

- Added a PieChart card to visualize order distribution by size
- Integrated real-time statistics via a dedicated service layer
- Enabled lazy loading of the dashboard component using the `lazy_components` registry
- Refactored the dashboard to use a registry-driven architecture
- Registered all dashboard cards via the `awesome_dashboard_items` registry category
- Introduced a settings dialog that allows users to enable or disable individual dashboard items
- Stored user preferences in `localStorage` to preserve dashboard layout between sessions
@robodoo
Copy link

robodoo commented Jul 11, 2025

Pull request status dashboard

@bit-odoo
Copy link

bit-odoo commented Jul 11, 2025

Base should be 18.0.And commit message should be proper.

@dhtr-odoo dhtr-odoo changed the base branch from master to 18.0 July 11, 2025 11:11
@dhtr-odoo dhtr-odoo changed the title 18.0 training tutorials dhtr [ADD] estate, awesome_dashboard, awesome_owl: tutorial chapters Jul 11, 2025
Copy link

@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,
i see many commented code in PR.You can remove this code.

'name': "Awesome Dashboard",

'summary': """
"name": "Awesome Dashboard",

Choose a reason for hiding this comment

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

Don't make unnecessary changes.

@@ -8,8 +8,9 @@

logger = logging.getLogger(__name__)


Choose a reason for hiding this comment

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

unnecessary extra line.

}

Choose a reason for hiding this comment

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

unnecessary changes.


}

registry.category("lazy_components").add("awesome_dashboard.AwesomeDashboard", AwesomeDashboard);

Choose a reason for hiding this comment

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

There should always be one blank line at the end of the file.

font-size: 48px;
color: #228B22;
font-weight: bold;
}

Choose a reason for hiding this comment

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

Same here, add one blank line.


offer_ids = fields.One2many("estate.property.offer", "property_id", string="Offers")

_sql_constraints = [

Choose a reason for hiding this comment

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

It should be defined after all field declarations.

<field name="print_report_name">'Salesman Property Offers - %s' % (object.name)</field>
</record>

</odoo>

Choose a reason for hiding this comment

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

Should be one blank line at the end of the file.

Comment on lines +73 to +74
for offer in self:
offer.status = "refused"

Choose a reason for hiding this comment

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

Should the user be able to refuse multiple offers at the same time?

Comment on lines +107 to +108
self.garden_area = 10
self.garden_orientation = "north"

Choose a reason for hiding this comment

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

we can use .write() here.

string="Garden Orientation",
)

postcode = fields.Char(string="Postcode")

Choose a reason for hiding this comment

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

It should be Integer().

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