74 lines
3.1 KiB
Markdown
74 lines
3.1 KiB
Markdown
# 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 `wrapDecimal` function to handle inventory-specific cases
|
|
- Added proper view inheritance for stock move line views
|
|
|
|
### Technical Changes
|
|
1. **Enhanced List View Patch**: Instead of stripping formatting from stock moves, now properly handles escaped HTML
|
|
2. **New Stock Move Patch**: Added specific handling for stock move line renderers and enhanced formatter registry
|
|
3. **Improved wrapDecimal Function**: Better regex handling for various number formats
|
|
4. **Enhanced Formatter Registry**: Comprehensive patching of all numeric formatters used in inventory
|
|
5. **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
|
|
1. Open browser developer tools (F12)
|
|
2. Go to Console tab
|
|
3. 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:
|
|
```javascript
|
|
// 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
|
|
1. **Check module loading**: Look for "Web Decimal Style module loaded successfully" in console
|
|
2. **Check field detection**: Look for logging messages when viewing inventory operations
|
|
3. **Verify decimal detection**: The module should detect values with decimal points (e.g., "123.45")
|
|
4. **Check CSS application**: Look for `<span class="o_decimal">` elements in the HTML
|
|
|
|
If decimal formatting is not working:
|
|
1. Refresh the page after module update
|
|
2. Clear browser cache
|
|
3. Check browser console for JavaScript errors
|
|
4. Verify the module is properly installed and upgraded
|
|
|
|
## Installation
|
|
|
|
1. Install the module
|
|
2. Restart Odoo
|
|
3. Update the module list
|
|
4. Install "Web Decimal Style"
|
|
|
|
The formatting will be applied automatically to all numeric fields across the system, including inventory operations. |