| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 174 |
| Technical Name |
evo_non_negative_widget |
| License | LGPL-3 |
| Website | https://evozard.com/ |
| Versions | 16.0 18.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 174 |
| Technical Name |
evo_non_negative_widget |
| License | LGPL-3 |
| Website | https://evozard.com/ |
| Versions | 16.0 18.0 |
Prevent Negative Values in Odoo Numeric Fields
Stop users from entering negative quantities or amounts in Integer and Float fields with real-time validation and warning notifications.
This application is suitable for:
Inventory, Sales & Purchase Teams
Businesses managing inventory, sales, or purchase orders where quantities must always remain positive.
Odoo Developers
Enforce non-negative constraints on any Integer or Float field without any backend model changes.
Manufacturing & Warehouse Teams
Prevent accidental negative stock or quantity entries to ensure accurate operations data.
Any Odoo Project
User-friendly client-side input validation on numeric fields across all editable views.
Key Features
Non-Negative Integer Widget
If the user types a negative number in an Integer field, the value is automatically reset to 0 and a warning notification is shown instantly.
Non-Negative Float Widget
Same protection for Float fields — supports decimal values and numpad input. Negative entries are corrected to 0.0 without disrupting the user flow.
Smart Warning Notification
The warning toast "Negative values are not allowed." appears only once per input session (debounced to 3 seconds), avoiding notification spam.
No "Invalid Fields" Odoo Error
Widget silently returns 0 instead of throwing a parse error — keeping the form saveable while still alerting the user.
Why Use This Module?
- Prevent accidental negative quantities
- Improve inventory and order accuracy
- Reduce common data-entry mistakes
- Better user validation experience
- Avoid backend validation complexity
- Works across all editable Odoo views
Example Use Cases
Inventory Management
Prevent warehouse staff from entering negative product quantities during stock adjustments or transfers.
Manufacturing Orders
Ensure component quantities on production orders always remain valid and non-negative.
Sales & Purchase Orders
Avoid incorrect negative order lines that could corrupt pricing or fulfillment data.
Custom ERP Development
Apply reusable client-side validation across any custom Odoo module with a single widget attribute.
Screenshots
When a user enters a negative number in an Integer field, the widget immediately resets it to 0 and shows a warning toast.
Integer field — negative value entered
Integer field — auto-corrected to 0 with warning
Same behaviour for Float fields — negative decimal values are auto-corrected to 0.0 with the same warning notification.
Float field — negative decimal entered
Float field — auto-corrected to 0.0 with warning
Technical Compatibility
Installation Example
Simply add the widget attribute to any Integer or Float field in your view XML:
Developer Friendly
- Easy widget integration
- No backend override required
- Lightweight client-side validation
- Compatible with custom modules
- Supports editable tree & one2many views
- Numpad & decimal input supported
Please log in to comment on this module