| models | ||
| static/src | ||
| __init__.py | ||
| __manifest__.py | ||
| README.md | ||
Web Decimal Style
This module enhances the display of decimal numbers in Odoo by styling the decimal part differently from the integer part.
Features
- Wraps decimal parts in a CSS class for custom styling
- Works across all numeric field types (float, monetary, percentage, etc.)
- Fixed: Proper decimal formatting in inventory detailed operations
- Enhanced support for stock moves and inventory operations
- Handles escaped HTML markup properly in list views
Recent Fixes
Inventory Operations Fix
- Issue: Decimal formatting was not working in inventory detailed operations
- Root Cause: Previous implementation stripped decimal formatting from stock moves to avoid HTML escaping issues
- Solution:
- Improved markup handling to preserve decimal formatting while avoiding escaping issues
- Added specific patches for stock move line renderers
- Enhanced the
wrapDecimalfunction to handle inventory-specific cases - Added proper view inheritance for stock move line views
Technical Changes
- Enhanced List View Patch: Instead of stripping formatting from stock moves, now properly handles escaped HTML
- New Stock Move Patch: Added specific handling for stock move line renderers and enhanced formatter registry
- Improved wrapDecimal Function: Better regex handling for various number formats
- Enhanced Formatter Registry: Comprehensive patching of all numeric formatters used in inventory
- Added Stock Dependency: Module now depends on stock module for proper integration
Usage
The module automatically applies decimal styling to all numeric fields. The decimal part will appear smaller and slightly transparent compared to the integer part.
Debugging
Console Debugging
- Open browser developer tools (F12)
- Go to Console tab
- Look for messages starting with:
- "Web Decimal Style module loaded successfully"
- "Universal Decimal Patch: Formatting"
- "Stock Operations: Applying decimal formatting"
Manual Testing
In the browser console, you can test the decimal formatting function:
// Test the wrapDecimal function
testDecimalStyle('123.45')
Visual Debugging
The CSS includes a debug indicator (🔸) that appears before each decimal part. This is currently enabled to help identify when decimal formatting is applied.
Troubleshooting Steps
- Check module loading: Look for "Web Decimal Style module loaded successfully" in console
- Check field detection: Look for logging messages when viewing inventory operations
- Verify decimal detection: The module should detect values with decimal points (e.g., "123.45")
- Check CSS application: Look for
<span class="o_decimal">elements in the HTML
If decimal formatting is not working:
- Refresh the page after module update
- Clear browser cache
- Check browser console for JavaScript errors
- Verify the module is properly installed and upgraded
Installation
- Install the module
- Restart Odoo
- Update the module list
- Install "Web Decimal Style"
The formatting will be applied automatically to all numeric fields across the system, including inventory operations.