Skip to Content
Odoo āđ€āļĄāļ™āļđ
  • āļĨāļ‡āļŠāļ·āđˆāļ­āđ€āļ‚āđ‰āļēāđƒāļŠāđ‰
  • āļ—āļ”āļĨāļ­āļ‡āđƒāļŠāđ‰āļŸāļĢāļĩ
  • āđāļ­āļ›
    āļāļēāļĢāđ€āļ‡āļīāļ™
    • āļĢāļ°āļšāļšāļšāļąāļāļŠāļĩ
    • āļĢāļ°āļšāļšāļāļēāļĢāļ­āļ­āļāđƒāļšāđāļˆāđ‰āļ‡āļŦāļ™āļĩāđ‰
    • āļĢāļ°āļšāļšāļšāļąāļāļŠāļĩāļĢāļēāļĒāļˆāđˆāļēāļĒ
    • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļāļēāļĢāļ‚āđ‰āļ­āļĄāļđāļĨāļœāđˆāļēāļ™āļŠāđ€āļ›āļĢāļ”āļŠāļĩāļ• (BI)
    • āđ€āļ­āļāļŠāļēāļĢ
    • āļĢāļ°āļšāļšāļĨāļ‡āļĨāļēāļĒāđ€āļ‹āđ‡āļ™
    āļāļēāļĢāļ‚āļēāļĒ
    • āļĨāļđāļāļ„āđ‰āļēāļŠāļąāļĄāļžāļąāļ™āļ˜āđŒ
    • āļāļēāļĢāļ‚āļēāļĒ
    • POS āļĢāđ‰āļēāļ™āļ„āđ‰āļē
    • POS āļĢāđ‰āļēāļ™āļ­āļēāļŦāļēāļĢ
    • āļĢāļ°āļšāļšāļŠāļĄāļąāļ„āļĢāļŠāļĄāļēāļŠāļīāļ
    • āļāļēāļĢāđ€āļŠāđˆāļē
    āļāļēāļĢāļˆāļąāļ”āļāļēāļĢāđ€āļ§āđ‡āļšāđ„āļ‹āļ•āđŒ
    • āđ€āļ„āļĢāļ·āđˆāļ­āļ‡āļĄāļ·āļ­āļŠāļĢāđ‰āļēāļ‡āđ€āļ§āđ‡āļšāđ„āļ‹āļ•āđŒ
    • āļ­āļĩāļ„āļ­āļĄāđ€āļĄāļīāļĢāđŒāļ‹
    • āļšāļĨāđ‡āļ­āļ
    • āļŸāļ­āļĢāļąāđˆāļĄ
    • āđ„āļĨāļŸāđŒāđāļŠāļ—
    • āļĢāļ°āļšāļšāļāļēāļĢāļ­āļšāļĢāļĄāļ­āļ­āļ™āđ„āļĨāļ™āđŒ
    āļ‹āļąāļžāļžāļĨāļēāļĒāđ€āļŠāļ™
    • āļ„āļĨāļąāļ‡āļŠāļīāļ™āļ„āđ‰āļē
    • āļĢāļ°āļšāļšāļāļēāļĢāļœāļĨāļīāļ•
    • PLM
    • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļ‹āļ·āđ‰āļ­
    • āļāļēāļĢāļ‹āđˆāļ­āļĄāļšāļģāļĢāļļāļ‡
    • āļĢāļ°āļšāļšāļˆāļąāļ”āļāļēāļĢāļ„āļļāļ“āļ āļēāļž
    āļ—āļĢāļąāļžāļĒāļēāļāļĢāļšāļļāļ„āļ„āļĨ
    • āļ‚āđ‰āļ­āļĄāļđāļĨāļžāļ™āļąāļāļ‡āļēāļ™
    • āļĢāļ°āļšāļšāļŠāļĢāļĢāļŦāļēāļšāļļāļ„āļĨāļēāļāļĢ
    • āļĢāļ°āļšāļšāļāļēāļĢāļĨāļē
    • āļāļēāļĢāļ›āļĢāļ°āđ€āļĄāļīāļ™
    • āļĢāļ°āļšāļšāļāļēāļĢāđāļ™āļ°āļ™āļģāļžāļ™āļąāļāļ‡āļēāļ™
    • āļĢāļ°āļšāļšāļˆāļąāļ”āļāļēāļĢāļĒāļēāļ™āļžāļēāļŦāļ™āļ°
    āļāļēāļĢāļ•āļĨāļēāļ”
    • āđ‚āļ‹āđ€āļŠāļĩāļĒāļĨāļĄāļēāļĢāđŒāđ€āļāđ‡āļ•āļ•āļīāđ‰āļ‡
    • āļāļēāļĢāļ•āļĨāļēāļ”āļœāđˆāļēāļ™āļ­āļĩāđ€āļĄāļĨ
    • āļĢāļ°āļšāļšāļāļēāļĢāļ•āļĨāļēāļ”āļœāđˆāļēāļ™ SMS
    • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļ‡āļēāļ™āļ­āļĩāđ€āļ§āļ™āļ•āđŒ
    • āļāļēāļĢāļ•āļĨāļēāļ”āđāļšāļšāļ­āļąāļ•āđ‚āļ™āļĄāļąāļ•āļī
    • āļĢāļ°āļšāļšāđāļšāļšāļŠāļģāļĢāļ§āļˆ
    āļāļēāļĢāļšāļĢāļīāļāļēāļĢ
    • āđ‚āļ›āļĢāđ€āļˆāļāļ•āđŒ
    • āļĢāļ°āļšāļšāļšāļąāļ™āļ—āļķāļāđ€āļ§āļĨāļē
    • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļāļēāļĢāļšāļĢāļīāļāļēāļĢāļ āļēāļ„āļŠāļ™āļēāļĄ
    • āļĢāļ°āļšāļšāļ”āļđāđāļĨāļŠāđˆāļ§āļĒāđ€āļŦāļĨāļ·āļ­
    • āļāļēāļĢāļ§āļēāļ‡āđāļœāļ™
    • āļāļēāļĢāļ™āļąāļ”āļŦāļĄāļēāļĒ
    āļ›āļĢāļ°āļŠāļīāļ—āļ˜āļīāļœāļĨ
    • āļĢāļ°āļšāļšāđāļŠāļ”āļ‡āļ„āļ§āļēāļĄāļ„āļīāļ”āđ€āļŦāđ‡āļ™
    • Artificial Intelligence
    • āđ„āļ­āđ‚āļ­āļ—āļĩ
    • VoIP
    • āļ„āļĨāļąāļ‡āļ‚āđ‰āļ­āļĄāļđāļĨ
    • WhatsApp
    āđāļ­āļ›āļžāļĨāļīāđ€āļ„āļŠāļąāļ™āļ‚āļ­āļ‡āļšāļļāļ„āļ„āļĨāļ—āļĩāđˆāļŠāļēāļĄ Odoo āļŠāļ•āļđāļ”āļīāđ‚āļ­ āđāļžāļĨāļ•āļŸāļ­āļĢāđŒāļĄāļ„āļĨāļēāļ§āļ”āđŒāļ‚āļ­āļ‡ Odoo
  • āļ­āļļāļ•āļŠāļēāļŦāļāļĢāļĢāļĄ
    āļāļēāļĢāļ„āđ‰āļēāļ›āļĨāļĩāļ
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāļŦāļ™āļąāļ‡āļŠāļ·āļ­
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāđ€āļŠāļ·āđ‰āļ­āļœāđ‰āļē
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāđ€āļŸāļ­āļĢāđŒāļ™āļīāđ€āļˆāļ­āļĢāđŒ
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāļ‚āļ­āļ‡āļŠāļģ
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāļŪāļēāļĢāđŒāļ”āđāļ§āļĢāđŒ
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāļ‚āļ­āļ‡āđ€āļĨāđˆāļ™
    āļ­āļēāļŦāļēāļĢ & āļāļēāļĢāļšāļĢāļīāļāļēāļĢ
    • āļšāļēāļĢāđŒāđāļĨāļ°āļœāļąāļš
    • āļĢāđ‰āļēāļ™āļ­āļēāļŦāļēāļĢ
    • āļ­āļēāļŦāļēāļĢāļŸāļēāļŠāļ•āđŒāļŸāļđāđ‰āļ”
    • āđ€āļāļŠāļ•āđŒāđ€āļŪāđ‰āļēāļŠāđŒ
    • āļ•āļąāļ§āđāļ—āļ™āļˆāļģāļŦāļ™āđˆāļēāļĒāđ€āļ„āļĢāļ·āđˆāļ­āļ‡āļ”āļ·āđˆāļĄ
    • āđ‚āļĢāļ‡āđāļĢāļĄ
    āļ­āļŠāļąāļ‡āļŦāļēāļĢāļīāļĄāļ—āļĢāļąāļžāļĒāđŒ
    • Real Estate Agency
    • āļšāļĢāļīāļĐāļąāļ—āļŠāļ–āļēāļ›āļąāļ•āļĒāļāļĢāļĢāļĄ
    • āļšāļĢāļīāļĐāļąāļ—āļĢāļąāļšāđ€āļŦāļĄāļē
    • Property Management
    • āļāļēāļĢāļˆāļąāļ”āļŠāļ§āļ™
    • āļŠāļĄāļēāļ„āļĄāđ€āļˆāđ‰āļēāļ‚āļ­āļ‡āļ­āļŠāļąāļ‡āļŦāļēāļĢāļīāļĄāļ—āļĢāļąāļžāļĒāđŒ
    āļ›āļĢāļķāļāļĐāļē
    • āļŠāļģāļ™āļąāļāļ‡āļēāļ™āļšāļąāļāļŠāļĩ
    • Odoo āļžāļēāļĢāđŒāļ—āđ€āļ™āļ­āļĢāđŒ
    • āđ€āļ­āđ€āļˆāļ™āļ‹āļĩāđˆāļāļēāļĢāļ•āļĨāļēāļ”
    • āļŠāļģāļ™āļąāļāļ‡āļēāļ™āļāļŽāļŦāļĄāļēāļĒ
    • āļšāļĢāļīāļāļēāļĢāļŠāļĢāļĢāļŦāļēāļšāļļāļ„āļĨāļēāļāļĢ
    • āļāļēāļĢāļ•āļĢāļ§āļˆāļŠāļ­āļšāđāļĨāļ°āļāļēāļĢāļĢāļąāļšāļĢāļ­āļ‡
    āļĢāļ°āļšāļšāļāļēāļĢāļœāļĨāļīāļ•
    • Textile
    • āđ€āļŦāļĨāđ‡āļ
    • āđ€āļŸāļ­āļĢāđŒāļ™āļīāđ€āļˆāļ­āļĢāđŒ
    • āļ­āļēāļŦāļēāļĢ
    • āđ‚āļĢāļ‡āļœāļĨāļīāļ•āđ€āļšāļĩāļĒāļĢāđŒ
    • āļ‚āļ­āļ‡āļ‚āļ§āļąāļāļ‚āļ­āļ‡āļ­āļ‡āļ„āđŒāļāļĢ
    āļŠāļļāļ‚āļ āļēāļž & āļŸāļīāļ•āđ€āļ™āļŠ
    • āļŠāļĄāļĢāļĄāļāļĩāļŽāļē
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāđāļ§āđˆāļ™āļ•āļē
    • āļŸāļīāļ•āđ€āļ™āļŠ
    • āļœāļđāđ‰āļ›āļĢāļ°āļāļ­āļšāļ§āļīāļŠāļēāļŠāļĩāļžāļ”āđ‰āļēāļ™āļŠāļļāļ‚āļ āļēāļž
    • āļĢāđ‰āļēāļ™āļ‚āļēāļĒāļĒāļē
    • āļĢāđ‰āļēāļ™āļ—āļģāļœāļĄ
    Trades
    • āļŠāđˆāļēāļ‡āļ‹āđˆāļ­āļĄ
    • āļŪāļēāļĢāđŒāļ”āđāļ§āļĢāđŒāđāļĨāļ°āļāļēāļĢāļŠāļ™āļąāļšāļŠāļ™āļļāļ™āļ”āđ‰āļēāļ™āđ„āļ­āļ—āļĩ
    • āļĢāļ°āļšāļšāļžāļĨāļąāļ‡āļ‡āļēāļ™āđāļŠāļ‡āļ­āļēāļ—āļīāļ•āļĒāđŒ
    • āļŠāđˆāļēāļ‡āļ—āļģāļĢāļ­āļ‡āđ€āļ—āđ‰āļē
    • āļšāļĢāļīāļāļēāļĢāļ—āļģāļ„āļ§āļēāļĄāļŠāļ°āļ­āļēāļ”
    • HVAC Services
    āļ­āļ·āđˆāļ™ āđ†
    • Nonprofit Organization
    • āļŠāļģāļ™āļąāļāļ‡āļēāļ™āļŠāļīāđˆāļ‡āđāļ§āļ”āļĨāđ‰āļ­āļĄ
    • āļĢāđ‰āļēāļ™āđ€āļŠāđˆāļēāļ›āđ‰āļēāļĒāđ‚āļ†āļĐāļ“āļē
    • āļāļēāļĢāļ–āđˆāļēāļĒāļ āļēāļž
    • āļĢāđ‰āļēāļ™āđ€āļŠāđˆāļēāļˆāļąāļāļĢāļĒāļēāļ™
    • āļ•āļąāļ§āđāļ—āļ™āļˆāļģāļŦāļ™āđˆāļēāļĒāļ‹āļ­āļŸāļ•āđŒāđāļ§āļĢāđŒ
    Browse all Industries
  • āļ„āļ­āļĄāļĄāļđāļ™āļīāļ•āļĩāđ‰
    āļĻāļķāļāļĐāļē
    • āļšāļ—āđ€āļĢāļĩāļĒāļ™
    • āđ€āļ­āļāļŠāļēāļĢāļāļģāļāļąāļšāđ‚āļ›āļĢāđāļāļĢāļĄ
    • āļāļēāļĢāļĢāļąāļšāļĢāļ­āļ‡
    • āļāļēāļĢāļāļķāļāļ­āļšāļĢāļĄ
    • āļšāļĨāđ‡āļ­āļ
    • āļžāļ­āļ”āđāļ„āļŠāļ•āđŒ
    āđ€āļžāļīāđˆāļĄāļĻāļąāļāļĒāļ āļēāļžāđƒāļŦāđ‰āļāļąāļšāļāļēāļĢāļĻāļķāļāļĐāļē
    • āđ‚āļ›āļĢāđāļāļĢāļĄāļāļēāļĢāļĻāļķāļāļĐāļē
    • Scale Up! Business Game
    • āđ€āļĒāļĩāđˆāļĒāļĄāļŠāļĄ Odoo
    āļĢāļąāļšāļ‹āļ­āļŸāļ•āđŒāđāļ§āļĢāđŒ
    • āļ”āļēāļ§āļ™āđŒāđ‚āļŦāļĨāļ”
    • āđ€āļ›āļĢāļĩāļĒāļšāđ€āļ—āļĩāļĒāļšāļĢāļļāđˆāļ™
    • āđ€āļœāļĒāđāļžāļĢāđˆ
    āļ—āļģāļ‡āļēāļ™āļĢāđˆāļ§āļĄāļāļąāļ™
    • Github
    • āļŸāļ­āļĢāļąāđˆāļĄ
    • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļ‡āļēāļ™āļ­āļĩāđ€āļ§āļ™āļ•āđŒ
    • āļāļēāļĢāđāļ›āļĨ
    • āļĢāđˆāļ§āļĄāđ€āļ›āđ‡āļ™āļžāļēāļĢāđŒāļ—āđ€āļ™āļ­āļĢāđŒ
    • Services for Partners
    • āļĨāļ‡āļ—āļ°āđ€āļšāļĩāļĒāļ™āđ€āļžāļ·āđˆāļ­āļŠāļĢāđ‰āļēāļ‡āļšāļąāļāļŠāļĩāļšāļĢāļīāļĐāļąāļ—āļ‚āļ­āļ‡āļ„āļļāļ“
    āļĢāļąāļšāļšāļĢāļīāļāļēāļĢ
    • āļ„āđ‰āļ™āļŦāļēāļžāļēāļĢāđŒāļ—āđ€āļ™āļ­āļĢāđŒ
    • āļ„āđ‰āļ™āļŦāļēāļ™āļąāļāļšāļąāļāļŠāļĩ
    • āļžāļšāļāļąāļšāļ—āļĩāđˆāļ›āļĢāļķāļāļĐāļē
    • āļšāļĢāļīāļāļēāļĢāļ•āļīāļ”āļ•āļąāđ‰āļ‡āļĢāļ°āļšāļšāđ€āļžāļ·āđˆāļ­āđƒāļŠāđ‰āļ‡āļēāļ™
    • āļ‚āđ‰āļ­āļĄāļđāļĨāļ­āđ‰āļēāļ‡āļ­āļīāļ‡āļĨāļđāļāļ„āđ‰āļē
    • āļāļēāļĢāļŠāļ™āļąāļšāļŠāļ™āļļāļ™
    • āļ­āļąāļ›āđ€āļāļĢāļ”
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    āļĢāļąāļšāļāļēāļĢāļŠāļēāļ˜āļīāļ•
  • āļĢāļēāļ„āļē
  • āļŠāđˆāļ§āļĒāđ€āļŦāļĨāļ·āļ­
āļ„āļļāļ“āļ•āđ‰āļ­āļ‡āļĨāļ‡āļ—āļ°āđ€āļšāļĩāļĒāļ™āđ€āļžāļ·āđˆāļ­āđ‚āļ•āđ‰āļ•āļ­āļšāļāļąāļšāļ„āļ­āļĄāļĄāļđāļ™āļīāļ•āļĩāđ‰
All Posts āļ„āļ™ āđ€āļŦāļĢāļĩāļĒāļāļĢāļēāļ‡āļ§āļąāļĨ
āđāļ—āđ‡āļ (View all)
odoo accounting v14 pos v15
āđ€āļāļĩāđˆāļĒāļ§āļāļąāļšāļŸāļ­āļĢāļąāđˆāļĄāļ™āļĩāđ‰
āļ„āļļāļ“āļ•āđ‰āļ­āļ‡āļĨāļ‡āļ—āļ°āđ€āļšāļĩāļĒāļ™āđ€āļžāļ·āđˆāļ­āđ‚āļ•āđ‰āļ•āļ­āļšāļāļąāļšāļ„āļ­āļĄāļĄāļđāļ™āļīāļ•āļĩāđ‰
All Posts āļ„āļ™ āđ€āļŦāļĢāļĩāļĒāļāļĢāļēāļ‡āļ§āļąāļĨ
āđāļ—āđ‡āļ (View all)
odoo accounting v14 pos v15
āđ€āļāļĩāđˆāļĒāļ§āļāļąāļšāļŸāļ­āļĢāļąāđˆāļĄāļ™āļĩāđ‰
āļŠāđˆāļ§āļĒāđ€āļŦāļĨāļ·āļ­

OWL Component Not Rendering in Custom Layout (Odoo 18) — Likely XML Template Issue

āļ•āļīāļ”āļ•āļēāļĄ

āļĢāļąāļšāļāļēāļĢāđāļˆāđ‰āļ‡āđ€āļ•āļ·āļ­āļ™āđ€āļĄāļ·āđˆāļ­āļĄāļĩāļāļīāļˆāļāļĢāļĢāļĄāđƒāļ™āđ‚āļžāļŠāļ•āđŒāļ™āļĩāđ‰

āļ„āļģāļ–āļēāļĄāļ™āļĩāđ‰āļ–āļđāļāļ•āļąāđ‰āļ‡āļ„āđˆāļēāļŠāļ–āļēāļ™āļ°
javascriptdevelopmentprojectdebug
2 āļ•āļ­āļšāļāļĨāļąāļš
5877 āļĄāļļāļĄāļĄāļ­āļ‡
āļ­āļ§āļ•āļēāļĢ
Kvrolito

🔧 OWL Component Not Rendering in Custom Layout (Odoo 18) — Likely XML Template Issue

Hello everyone,

I'm currently working on Odoo 18 and trying to render a simple OWL component inside a custom dashboard layout. Despite successfully loading all related JS files, the component does not appear in the UI, and I suspect the issue lies in how the XML template is handled.

📁 Project Structure

My layout is defined in:

my_module/static/src/views/dashboard_page_layout.xml

My JS files are located in:

my_module/static/src/js/

ðŸ“Ķ Files

HelloBox.js

/** @odoo-module **/

import { Component, xml } from '@odoo/owl';

export class HelloBox extends Component {}

HelloBox.template = xml`
  <div class="hello-box">
    <h1><t t-esc="props.title"/></h1>
    <button t-on-click="sayHello">Click me</button>
  </div>
`;

HelloBox.props = {
  title: { type: String },
};

HelloBox.prototype.sayHello = function () {
  alert('Hello from OWL!');
};

HelloBox.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
  <t t-name="my_module.HelloBox" owl="1">
    <div class="p-3">
      <p><t t-out="props.title"/></p>
      <button>Click me</button>
    </div>
  </t>
</templates>

init_owl.js

/** @odoo-module **/

import { mount, whenReady } from '@odoo/owl';
import { HelloBox } from './HelloBox';

whenReady(() => {
  const root = document.getElementById('hello-box-root');
  console.log('Mounting HelloBox in:', root);

  if (root) {
    mount(HelloBox, {
      target: root,
      props: { title: 'Witaj z OWL!' },
    });
  }
});

In my dashboard_page_layout.xml, I manually placed:

<div id="hello-box-root"></div>

ðŸ§Đ Problem Focus

✅ The JS loads successfully, console.log confirms the mount target exists, and the component code is correct.

❌ The XML template seems to be the weak point — I suspect it may not be loaded or registered correctly, despite being included in the assets.

In some cases I even get:

TypeError: Cannot read properties of undefined (reading 'defaultProps')

Which usually indicates OWL is trying to mount an incomplete or undefined component — possibly due to the XML template not being properly compiled or injected.

📜 __manifest__.py

'assets': {
    'web.assets_frontend': [
        'my_module/static/src/js/HelloBox.xml',
        'my_module/static/src/js/HelloBox.js',
        'my_module/static/src/js/init_owl.js',
    ],
},

I've also tried adding the XML to web.assets_qweb, web.assets_backend, and changing the load order, but the issue remains.

🙏 What I'm Looking For

  • How should XML templates be properly registered in OWL/Odoo 18 when working with web.assets_frontend?
  • Do I need to explicitly register or reference them in a different way?
  • Is there anything missing to make this work with t-name="my_module.HelloBox"?
  • Is using xml\template`` inside the JS file the preferred approach instead?

Any guidance would be highly appreciated.

Thanks in advance for your support!

Karol


0
āļ­āļ§āļ•āļēāļĢ
āļĨāļ°āļ—āļīāđ‰āļ‡
Kvrolito
āļœāļđāđ‰āđ€āļ‚āļĩāļĒāļ™


Unfortunately, that’s not the case. While I’ve successfully used inline XML templates, that’s not the approach I want to take. I’d like to define my OWL templates in separate XML files so that I can pass props and create dynamic, reusable components.

ðŸ§Đ Template File: owl_templates.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
  <t t-name="my_folder.owl_main_component" owl="1">
    <div>
      <h3>This is rendered using OWL</h3>
    </div>
    <!-- I intentionally commented out the <t> tag earlier to test loading -->
  </t>
</templates>

🧠 Component File: owl_component.js

/** @odoo-module **/

import { Component, mount, xml, whenReady } from '@odoo/owl';
import { templates } from '@web/core/assets';

export class OwlMainComponent extends Component {}

OwlMainComponent.template = 'my_folder.owl_main_component';

// VERSION 1: await template loading inside whenReady
whenReady(async () => {
	await templates;
	const element = document.getElementById('hello-box-root');
	if (element) {
		mount(OwlMainComponent, element);
	} else {
		console.warn('❌ Missing #hello-box-root');
	}
});

// VERSION 2: naive sync mount
// const element = document.getElementById('hello-box-root');
// mount(OwlMainComponent, element);

// VERSION 3: basic whenReady
// whenReady(() => {
// 	const element = document.getElementById('hello-box-root');
// 	if (element) {
// 		mount(OwlMainComponent, element, { templates });
// 	}
// });

🔍 Investigation So Far

When I intentionally break the XML file (e.g. by removing a <t>), Odoo correctly throws an error — which proves the XML is found and parsed.

I also inspected the compiled web.assets_frontend_lazy.js. It turns out:

  • The component is mounted around line 97278
  • The XML template is only registered around line 104900

This confirms the component tries to render before the template is available.

🧊 Asset Load Order (Manifest)

To fix this, I tried forcing the load order using before and prepend:

'web.assets_frontend': [
    # ('prepend', 'my_folder/static/src/js/owl_templates.xml'),
    # ('before', 'my_folder/static/src/js/owl_component.js',
    #           'my_folder/static/src/js/owl_templates.xml'),
    ('before', 'my_folder/static/src/js/owl_templates.xml', 
               'my_folder/static/src/js/owl_component.js'),
]

However, every attempt resulted in an error saying either the XML or JS file could not be found — depending on which directive I used.

🆘 Summary

At this point I’ve tried every variation I could think of. It’s very frustrating that something as basic as loading a QWeb XML file into an OWL component doesn't work as expected.

If anyone has had success with a similar setup or knows what I might be doing wrong — I’d deeply appreciate your help 🙏

āļ­āļ§āļ•āļēāļĢ
Cybrosys Techno Solutions Pvt.Ltd
āļ„āļģāļ•āļ­āļšāļ—āļĩāđˆāļ”āļĩāļ—āļĩāđˆāļŠāļļāļ”

Hi,

The root cause is that mount() resolves templates immediately at call time, but in a compiled bundle the XML registrations happen after the JS modules run so the template simply isn't there yet. The fix is to use the App constructor with getTemplate instead of mount(), which defers template lookup to the first render cycle by which point all XML is registered:

/** @odoo-module **/

import { Component, App, whenReady } from '@odoo/owl';
import { getTemplate } from '@web/core/templates';

export class OwlMainComponent extends Component {
    static template = 'my_folder.owl_main_component';
    static props = { title: String };
}

whenReady(() => {
    const element = document.getElementById('hello-box-root');
    if (!element) return;

    new App(OwlMainComponent, {
        getTemplate,
        props: { title: 'Witaj z OWL!' },
    }).mount(element);
});

No changes needed to your XML or manifest load order getTemplate from @web/core/templates is the Odoo 18 bridge that hands OWL a lazy resolver instead of a pre-baked template map, so it always finds the template when rendering actually begins.


Hope it helps

0
āļ­āļ§āļ•āļēāļĢ
āļĨāļ°āļ—āļīāđ‰āļ‡
āļ­āļ§āļ•āļēāļĢ
D Enterprise
āļ„āļģāļ•āļ­āļšāļ—āļĩāđˆāļ”āļĩāļ—āļĩāđˆāļŠāļļāļ”

Hii

__manifest__.py

{ "name": "Custom OWL Dashboard", "version": "1.0", "depends": ["base", "web"], "assets": { "web.assets_frontend": [ "my_module/static/src/js/HelloBox.js", "my_module/static/src/js/init_owl.js", ], }, "data": [ "views/dashboard_menu.xml", ], "installable": True, "application": True, }

HelloBox.js

my_module/static/src/js/HelloBox.js

/** @odoo -module **/ import { Component, xml } from "@odoo/owl"; export class HelloBox extends Component { static template = xml` <div class="hello-box bg-light p-3 rounded shadow"> <h2 class="mb-3"><t t-esc="props.title"/></h2> <button class="btn btn-primary" t-on-click="sayHello">Click me</button> </div> `; static props = { title: { type: String }, }; sayHello() { alert("Hello from OWL!"); } }

init_owl.js

my_module/static/src/js/init_owl.js

/** @odoo -module **/ import { mount, whenReady } from "@odoo/owl"; import { HelloBox } from "./HelloBox"; whenReady(() => { const root = document.getElementById("hello-box-root"); console.log("ðŸ“Ķ Mounting HelloBox into", root); if (root) { mount(HelloBox, { target: root, props: { title: "Hello from OWL!", }, }); } else { console.warn("⚠ïļ Element #hello-box-root not found."); } });

dashboard_menu.xml

my_module/views/dashboard_menu.xml


<odoo> <template id="assets_backend" inherit_id="web.assets_backend" name="OWL Dashboard Assets"> <xpath expr="." position="inside"> <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.min.css"/> </xpath> </template> <record id="action_dashboard_hello" model="ir.actions.client"> <field name="name">OWL Dashboard</field> <field name="tag">hello_dashboard</field> </record> <menuitem id="menu_owl_dashboard_root" name="OWL Dashboard" sequence="10"/> <menuitem id="menu_owl_dashboard" parent="menu_owl_dashboard_root" name="Hello" action="action_dashboard_hello"/> </odoo>

JS Controller (Frontend Mount)

You need to register your OWL component on that page. Add this file:

my_module/static/src/js/dashboard_controller.js (optional if you're using OWL directly)

If you're using the tag 'hello_dashboard', register it using a JS client action — or skip that if you're directly including the root container via another QWeb view.

i hope it is usefull

0
āļ­āļ§āļ•āļēāļĢ
āļĨāļ°āļ—āļīāđ‰āļ‡
āļŠāļ™āļļāļāļāļąāļšāļāļēāļĢāļžāļđāļ”āļ„āļļāļĒāļ™āļĩāđ‰āđƒāļŠāđˆāđ„āļŦāļĄ? āđ€āļ‚āđ‰āļēāļĢāđˆāļ§āļĄāđ€āļĨāļĒ!

āļŠāļĢāđ‰āļēāļ‡āļšāļąāļāļŠāļĩāļ§āļąāļ™āļ™āļĩāđ‰āđ€āļžāļ·āđˆāļ­āđ€āļžāļĨāļīāļ”āđ€āļžāļĨāļīāļ™āđ„āļ›āļāļąāļšāļŸāļĩāđ€āļˆāļ­āļĢāđŒāļžāļīāđ€āļĻāļĐāđāļĨāļ°āļĄāļĩāļŠāđˆāļ§āļ™āļĢāđˆāļ§āļĄāļāļąāļšāļ„āļ­āļĄāļĄāļđāļ™āļīāļ•āļĩāđ‰āļ—āļĩāđˆāļĒāļ­āļ”āđ€āļĒāļĩāđˆāļĒāļĄāļ‚āļ­āļ‡āđ€āļĢāļē!

āļĨāļ‡āļŠāļ·āđˆāļ­
Related Posts āļ•āļ­āļšāļāļĨāļąāļš āļĄāļļāļĄāļĄāļ­āļ‡ āļāļīāļˆāļāļĢāļĢāļĄ
How to hide the title or the close (X) button from a dialogService dialog?
javascript development debug
āļ­āļ§āļ•āļēāļĢ
āļ­āļ§āļ•āļēāļĢ
2
āļ.āļĒ. 25
2360
What is an API in app development, and how do you create one for a mobile or web application?
javascript development debug workflow
āļ­āļ§āļ•āļēāļĢ
0
āļ.āļž. 26
18
Adding FileInput Component through patch not working
javascript development accounting debug
āļ­āļ§āļ•āļēāļĢ
1
āļ.āļž. 26
1140
Error with rpc call
javascript development function debug
āļ­āļ§āļ•āļēāļĢ
āļ­āļ§āļ•āļēāļĢ
āļ­āļ§āļ•āļēāļĢ
2
āļ.āļ„. 25
3319
Custom Cards Payment Module: POS Payment Summary Not Updating with Installments
javascript development sales project
āļ­āļ§āļ•āļēāļĢ
āļ­āļ§āļ•āļēāļĢ
2
āļ.āļž. 25
3144
āļ„āļ­āļĄāļĄāļđāļ™āļīāļ•āļĩāđ‰
  • āļšāļ—āđ€āļĢāļĩāļĒāļ™
  • āđ€āļ­āļāļŠāļēāļĢāļāļģāļāļąāļšāđ‚āļ›āļĢāđāļāļĢāļĄ
  • āļŸāļ­āļĢāļąāđˆāļĄ
āđ‚āļ­āđ€āļžāļ™āļ‹āļ­āļĢāđŒāļŠ
  • āļ”āļēāļ§āļ™āđŒāđ‚āļŦāļĨāļ”
  • Github
  • Runbot
  • āļāļēāļĢāđāļ›āļĨ
āļšāļĢāļīāļāļēāļĢ
  • āđ‚āļŪāļŠāļ•āļīāđ‰āļ‡ odoo.sh āđ€āļ‹āļīāļĢāđŒāļŸāđ€āļ§āļ­āļĢāđŒ
  • āļāļēāļĢāļŠāļ™āļąāļšāļŠāļ™āļļāļ™
  • āļ­āļąāļ›āđ€āļāļĢāļ”
  • āļāļēāļĢāļžāļąāļ’āļ™āļēāļ—āļĩāđˆāļāļģāļŦāļ™āļ”āđ€āļ­āļ‡
  • āļāļēāļĢāļĻāļķāļāļĐāļē
  • āļ„āđ‰āļ™āļŦāļēāļ™āļąāļāļšāļąāļāļŠāļĩ
  • āļ„āđ‰āļ™āļŦāļēāļžāļēāļĢāđŒāļ—āđ€āļ™āļ­āļĢāđŒ
  • āļĢāđˆāļ§āļĄāđ€āļ›āđ‡āļ™āļžāļēāļĢāđŒāļ—āđ€āļ™āļ­āļĢāđŒ
āđ€āļāļĩāđˆāļĒāļ§āļāļąāļšāđ€āļĢāļē
  • āļšāļĢāļīāļĐāļąāļ—āļ‚āļ­āļ‡āđ€āļĢāļē
  • āļ—āļĢāļąāļžāļĒāđŒāļŠāļīāļ™āđƒāļ™āļĢāļđāļ›āļ‚āļ­āļ‡āđ€āļ„āļĢāļ·āđˆāļ­āļ‡āļŦāļĄāļēāļĒāļāļēāļĢāļ„āđ‰āļē
  • āļ•āļīāļ”āļ•āđˆāļ­āđ€āļĢāļē
  • āļ‡āļēāļ™
  • āļĢāļ°āļšāļšāļāļēāļĢāļˆāļąāļ”āļ‡āļēāļ™āļ­āļĩāđ€āļ§āļ™āļ•āđŒ
  • āļžāļ­āļ”āđāļ„āļŠāļ•āđŒ
  • āļšāļĨāđ‡āļ­āļ
  • āļĨāļđāļāļ„āđ‰āļē
  • āļāļŽāļŦāļĄāļēāļĒ â€Ē āļ„āļ§āļēāļĄāđ€āļ›āđ‡āļ™āļŠāđˆāļ§āļ™āļ•āļąāļ§
  • āļ„āļ§āļēāļĄāļ›āļĨāļ­āļ”āļ āļąāļĒ
Ø§Ų„Ų’ØđŲŽØąŲŽØĻŲŠŲ‘ØĐ Català įŪ€ä―“äļ­æ–‡ įđéŦ”äļ­æ–‡ (台įĢ) ČeÅĄtina Dansk Nederlands English Suomi Français Deutsch āĪđāĪŋāĪ‚āĪĶāĨ€ Bahasa Indonesia Italiano æ—ĨæœŽčŠž 한ęĩ­ė–ī (KR) LietuviÅģ kalba Język polski PortuguÊs (BR) romÃĒnă Ņ€ŅƒŅŅÐšÐļÐđ ŅÐ·Ņ‹Ðš SlovenskÃ― jazyk SlovenÅĄÄina EspaÃąol (AmÃĐrica Latina) EspaÃąol Svenska āļ āļēāļĐāļēāđ„āļ—āļĒ TÞrkçe ŅƒÐšŅ€Ð°Ņ—Ð―ŅŅŒÐšÐ° Tiášŋng Viáŧ‡t

Odoo āđ€āļ›āđ‡āļ™āļŠāļļāļ”āđāļ­āļ›āļ˜āļļāļĢāļāļīāļˆāđāļšāļšāđ€āļ›āļīāļ”āļ—āļĩāđˆāļ„āļĢāļ­āļšāļ„āļĨāļļāļĄāļ—āļļāļāļ„āļ§āļēāļĄāļ•āđ‰āļ­āļ‡āļāļēāļĢāļ‚āļ­āļ‡āļšāļĢāļīāļĐāļąāļ—āļ‚āļ­āļ‡āļ„āļļāļ“ āļ­āļēāļ˜āļī CRM eCommerce āļĢāļ°āļšāļšāļšāļąāļāļŠāļĩ āļĢāļ°āļšāļšāļ„āļĨāļąāļ‡āļŠāļīāļ™āļ„āđ‰āļē āļĢāļ°āļšāļšāļāļēāļĢāļ‚āļēāļĒāļŦāļ™āđ‰āļēāļĢāđ‰āļēāļ™ āđ‚āļ›āļĢāđ€āļˆāļāļ•āđŒ āđāļĨāļ° āļ­āļĩāļāļĄāļēāļāļĄāļēāļĒ

āļ„āļ§āļēāļĄāđ€āļŦāļ™āļ·āļ­āļāļ§āđˆāļēāļ­āļąāļ™āđ€āļ›āđ‡āļ™āđ€āļ­āļāļĨāļąāļāļĐāļ“āđŒāļ‚āļ­āļ‡ Odoo āļ„āļ·āļ­āļāļēāļĢāđƒāļŠāđ‰āļ‡āļēāļ™āļ—āļĩāđˆāļ‡āđˆāļēāļĒāļ”āļēāļĒāđāļĨāļ°āļœāļŠāļēāļ™āļāļēāļĢāļ—āļģāļ‡āļēāļ™āļ­āļĒāđˆāļēāļ‡āļŠāļĄāļšāļđāļĢāļ“āđŒāđāļšāļšāđƒāļ™āđ€āļ§āļĨāļēāđ€āļ”āļĩāļĒāļ§āļāļąāļ™

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now