Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. dialog
  3. Modal Style v 17.0
  4. Sales Conditions FAQ

Modal Style

by YLHC Technology https://www.ylhctec.com , co. https://www.ylhctec.com , ltd. https://www.ylhctec.com
Odoo

$ 23.04

v 17.0 Third Party
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 194
Technical Name ylhc_modal_style
LicenseOPL-1
Websitehttps://www.ylhctec.com
Versions 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 194
Technical Name ylhc_modal_style
LicenseOPL-1
Websitehttps://www.ylhctec.com
Versions 17.0 18.0
  • Description
  • License

Modal Style Customization

Easily customize Odoo modal width, position, and style


A powerful module that gives you complete control over all modal dialog styles in Odoo. With simple context configuration, you can customize modal width, position, and other CSS styles without writing any frontend code!

Preview

See how to customize modal width and style in action

Modal Style Demo

Key Features

Custom Width

Flexibly control modal width with pixels, percentages, or any CSS unit

CSS Style Support

Support any CSS style properties with complete modal appearance control

Plug & Play

No code modification needed, simply use context configuration

Multiple Dialog Support

Support all dialog types: forms, selects, actions, relational fields, etc.

Extra Classes

Add custom CSS classes for more complex styling customization

Seamless Integration

Perfect compatibility with Odoo 18.0, based on OWL 2.0 framework

Usage Guide

This module provides a simple yet powerful way to customize modal styles. Just add configuration in your action or context.

Basic Configuration

Set modal CSS styles using the modal_style parameter:

{
    'type': 'ir.actions.act_window',
    'res_model': 'your.model',
    'view_mode': 'form',
    'target': 'new',
    'context': {
        'modal_style': 'max-width: 1800px !important;'
    }
}
Width Configuration Examples
Configuration Effect Use Case
'modal_style': 'max-width: 90%' Modal max-width is 90% of screen width Large screen display with margins
'modal_style': 'max-width: 1800px' Modal max-width is 1800 pixels Fixed width for complex forms
'modal_style': 'min-width: 600px; max-width: 80%' Minimum 600px, maximum 80% of screen Responsive design for various screens
'modal_style': 'width: 100vw; max-width: 100%' Full screen width Maximum display space needed
Python Code Examples
1. Form View Dialog
def open_custom_form(self):
    return {
        'type': 'ir.actions.act_window',
        'name': 'Custom Form',
        'res_model': 'res.partner',
        'view_mode': 'form',
        'target': 'new',
        'context': {
            'modal_style': 'max-width: 90%; min-height: 600px;',
            'default_name': 'New Partner'
        }
    }
2. Select Dialog
def select_records(self):
    return {
        'type': 'ir.actions.act_window',
        'name': 'Select Records',
        'res_model': 'product.product',
        'view_mode': 'list,form',
        'target': 'new',
        'context': {
            'modal_style': 'max-width: 1600px !important;',
            'search_default_active': 1
        }
    }
3. Relational Field Configuration (Many2one/Many2many)
<field name="partner_ids" 
    widget="many2many_tags"
    context="{'modal_style': 'max-width: 85%'}" />

<field name="product_id" 
    options="{'no_create': True}"
    context="{'modal_style': 'max-width: 1200px; height: 80vh;'}" />
4. XML View Configuration
<button name="custom_action" 
    type="object" 
    string="Open Modal"
    context="{'modal_style': 'max-width: 90%'}" />
Advanced Usage
Combine Multiple Style Properties
'context': {
    'modal_style': 'max-width: 90%; min-height: 500px; margin-top: 50px;'
}
Add Custom Classes with extra_classes
'context': {
    'modal_style': 'max-width: 1800px;',
    'extra_classes': 'my-custom-modal-class'
}
Important Tips:
  • Recommend using !important to ensure style priority
  • All standard CSS style properties are supported
  • Multiple styles can be combined, separated by semicolons
  • For responsive design, recommend using percentages or viewport units

Supported Dialog Types

This module extends all of the following Odoo core dialog components through patch mechanism:

Dialog

Base dialog component, parent class for all modals

ActionDialog

Action dialog for executing window actions

FormViewDialog

Form view dialog for creating and editing records

SelectCreateDialog

Select/create dialog for choosing existing records or creating new ones

X2ManyFieldDialog

Relational field dialog for One2many and Many2many fields

Technical Implementation

This module uses Odoo OWL framework's patch mechanism to extend standard dialog components:

  • Extend dialog component props using patch()
  • Automatically read modal_style configuration from context
  • Apply styles to DOM through XML template inheritance
  • Support configuration priority: props > context
  • Compatible with Odoo 18.0 and OWL 2.0 framework
Priority Rule:

According to memory specification, components prioritize props values first. If not present, then retrieve from context to ensure correct configuration priority.

Frequently Asked Questions

How to set the maximum width of a modal?
Add 'modal_style': 'max-width: 1800px !important;' to the context, where 1800px can be replaced with any width value you need.
Can I set the height of the modal?
Yes! Use 'modal_style': 'min-height: 600px; max-height: 90vh;' to control height. The vh unit represents a percentage of the viewport height.
Why isn't my style taking effect?
Please ensure:
  • The module is installed and enabled
  • You've used !important to increase style priority
  • Context configuration format is correct
  • Clear browser cache and retry
Can I use this with relational fields?
Absolutely! Add configuration to the field's context attribute: <field name="partner_ids" context="{'modal_style': 'max-width: 90%'}" />
Which CSS properties are supported?
All standard CSS style properties are supported, including but not limited to: width, max-width, min-width, height, margin, padding, border, etc. Multiple properties can be combined separated by semicolons.

Contact & Support

For any questions or technical support, please feel free to contact us:

Company: YLHC Technology, co., ltd.

Website: https://www.ylhctec.com

Email: support@ylhctec.com

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with