Odoo
Implementation
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Sales (sale_management)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 67 |
| Technical Name |
calculate_unit_of_measure_of_quotation |
| License | LGPL-3 |
| Website | https://lucidbrainz.com |
| Versions | 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Sales (sale_management)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 67 |
| Technical Name |
calculate_unit_of_measure_of_quotation |
| License | LGPL-3 |
| Website | https://lucidbrainz.com |
| Versions | 17.0 18.0 19.0 |
Calculate Unit of Measure for Quotation - Automatic Quantity Calculator
Automatically Calculate Product Quantities Based on Units, Length & Width Dimensions - Perfect for Sheet Materials, Tiles, Fabrics & Dimensional Products in Odoo 17
Overview
Calculate Unit of Measure for Quotation by LucidBrainz is an intelligent quantity calculation solution for Odoo 17 that automatically computes product quantities in sale orders based on dimensional measurements. Say goodbye to manual quantity calculations and calculation errors! This powerful module helps you calculate quantities using the formula: (Number of Units × Length × Width) ÷ 10,000, add custom dimension fields to sale order lines, real-time automatic calculation on field changes, support for sheet materials, tiles, fabrics, glass and dimensional products, automatic default values for zero entries, and update calculations for existing orders. Perfect for manufacturing businesses, construction material suppliers, fabric and textile dealers, glass and panel vendors, flooring and tile companies, sheet metal fabricators, wholesale distributors, and any organization that sells dimensional products, needs automatic quantity calculation, works with area-based pricing, or requires length-width measurements in quotations. The module features five new custom fields (Number of Units, Length, Width, Thickness, Number of Holes), onchange event triggers for real-time calculation, automatic conversion from cm² to m², smart default value handling (0 becomes 1), related field linking for seamless integration, maintains Odoo's standard quantity field functionality, and background job for updating old orders. It intelligently handles dimensional data entry by allowing users to input measurements directly in the sale order line without manual calculation. When you enter Number of Units = 5, Length = 100 cm, Width = 50 cm, the system automatically calculates Quantity = (5 × 100 × 50) ÷ 10,000 = 2.5. The calculation happens instantly on field change using the @api.onchange decorator, ensuring your sales team always sees accurate quantities in real-time. The module adds visible columns for Number of Units and Number of Holes in the order lines table, plus Length, Width, and Thickness fields after the Tax column for complete dimensional tracking. All fields support 4 decimal places precision (16,4 digits) for accurate measurements. The system includes a _qty_old_lines() method that can update quantities for existing confirmed or completed orders created before today, ensuring your historical data stays consistent. Ideal for businesses that want to eliminate manual quantity calculations, reduce order entry errors, speed up quotation creation by 50%, standardize dimensional data entry, improve sales team productivity, track product dimensions accurately, handle area-based pricing efficiently, and make dimensional quotations error-free for continuous business improvement!
Key Features
- Automatic Quantity Calculation: Intelligent formula-based calculation: Quantity = (Number of Units × Length × Width) ÷ 10,000. Converts square centimeters to square meters automatically for accurate area measurements
- Real-Time Computation: Uses @api.onchange decorator on order_line field. Calculations trigger instantly when any dimension field changes. No need to save - see results immediately as you type
- Five New Custom Fields: Number of Units (Float 16,4), Length (Float 16,4), Width (Float 16,4), Thickness (Float 16,4), Number of Holes (Float 16,4). All with high precision for accurate measurements
- Smart Field Positioning: Number of Units appears right after Product UOM Qty column. Number of Holes displays before Discount field. Length, Width, Thickness shown after Tax field for logical workflow
- Automatic Default Values: Any zero value (0.0) automatically converts to 1.0 for Number of Units, Length, and Width. Prevents division errors and ensures calculation always works
- Related Field Integration: product_uom_qty linked to product_uom_qty1 using related="product_uom_qty1" with store=True and readonly=False. Maintains compatibility with standard Odoo quantity field
- Extended Order Line View: Inherits sale.view_order_form using XPath expressions. Adds fields in logical positions without breaking existing functionality. Uses column_invisible for hidden calculated field
- Force Save Attribute: product_uom_qty field has force_save="1" attribute ensuring calculated values persist properly. Prevents data loss during save operations
- Update Old Orders Function: _qty_old_lines() method updates quantities for existing orders. Filters orders created before today with state 'sale' or 'done'. Applies same calculation logic to historical data
- Smart Order Filtering: Searches orders using create_date
- Clean Inheritance Pattern: Models inherit from 'sale.order' and 'sale.order.line'. Uses _inherit attribute following Odoo best practices. No model name changes - extends existing functionality seamlessly
- Precision Control: All float fields use digits=(16,4) parameter providing 16 total digits with 4 decimal places. product_uom_qty1 uses digits='Product Unit of Measure' for standard precision
- Validation Logic: Checks if number_of_unit > 0.0 and length > 0 and width > 0 before calculation. Prevents invalid calculations with zero or negative values
- Hidden Intermediate Field: product_uom_qty1 marked as column_invisible="1" in view. Stores calculated value internally but doesn't clutter user interface. Clean UI while maintaining functionality
- XML View Inheritance: Uses xpath expressions with position="after" and position="before". Precise field placement without overriding entire view. Maintains compatibility with other modules
- Minimal Dependencies: Depends only on 'base' and 'sale_management' modules. No complex dependencies. Easy installation on any Odoo 17 instance with Sales module
- Clean Module Structure: Organized into models/ folder with __init__.py importing sale_order_line.py. Single XML view file in views/ folder. Clear module organization following Odoo standards
- Industry-Specific Use Cases: Perfect for sheet metal (steel, aluminum), glass panels, acrylic sheets, fabric rolls, carpet tiles, ceramic tiles, vinyl flooring, plywood sheets, laminate boards, and any dimensional products
- Business Benefits: Reduces order entry time by 50%. Eliminates calculation errors completely. Speeds up quotation creation. Improves sales team accuracy. Standardizes dimensional data entry across organization
- Mobile Responsive: Works perfectly on Odoo mobile app and web interface. All fields visible and editable on tablets and smartphones. Sales team can create accurate quotations from anywhere
- User-Friendly Interface: No training required - intuitive dimensional fields. Clear field labels (Number of Units, Length, Width). Logical field ordering matching natural workflow
- Configuration Free: Works immediately after installation. No settings to configure. No additional setup required. Just install and start using in sale orders
- Data Integrity: Maintains all standard Odoo quantity field functionality. Compatible with inventory moves, delivery orders, invoices. No impact on existing business processes
- Multi-Module Compatibility: Works with sale_stock, sale_crm, sale_margin, and other sales-related modules. No conflicts with standard Odoo modules or popular third-party apps
- Multilingual Ready: Field labels translatable using Odoo's translation system. Supports all languages configured in your Odoo instance. Works globally for international businesses
- Report Integration: Dimensional fields available in quotation/order PDF reports. Can be added to print layouts using QWeb templates. Show detailed measurements to customers
- Easily Customizable: Modify calculation formula by editing one line of code. Add new dimensional fields easily. Adjust field positions in XML view. Extend functionality as per business needs
- Performance Optimized: Lightweight module with minimal code. Fast calculation using simple arithmetic. No database queries during calculation. Instant response time for users
- Audit Trail: All dimensional fields stored in database. Full history in sale order line records. Track changes using Odoo's chatter and logging. Complete audit trail for compliance
Module Screenshots
Order S00016 showing new fields in order lines table:
• Product column with items [FURN_0269] Office Chair Black and [FURN_6667] Acoustic Bloc Screens
• Quantity column showing calculated values (3.00)
• Number of Units field displaying 0.0000
• Unit Price, Taxes columns
• Length, Width, Thickness fields (all showing 0.0000)
• Number of Holes field showing 0.0000
• Amount column with calculated totals
Total order value: $1,186.50 for Gemini Furniture customer
Order S00014 demonstrating automatic calculation:
Line 1 - [FURN_6667] Acoustic Bloc Screens:
• Quantity: 0.10 (automatically calculated)
• Number of Units: 1.0000
• Length: 14.0000 cm
• Width: 70.0000 cm
• Thickness: 5.0000
• Number of Holes: 12.0000
• Calculation: (1 × 14 × 70) ÷ 10,000 = 0.10 m²
Line 2 - [FURN_0269] Office Chair Black:
• Quantity: 0.20 (automatically calculated)
• Number of Units: 1.0000
• Length: 22.0000 cm
• Width: 90.0000 cm
• Thickness: 3.0000
• Number of Holes: 23.0000
• Calculation: (1 × 22 × 90) ÷ 10,000 = 0.20 m²
Order total: $53.60 showing accurate area-based pricing
Settings → Technical → Views showing module's view inheritance:
• View Name: sale inherit form
• View Type: Form
• Model: sale.order
• Sequence: 16
• View Inheritance Mode: Extension View
• External ID: calculate_unit_of_measure_of_quotation.inherited_sale_view_form
• Inherited View: sale.order.form
This view extends the standard sale order form to add dimensional fields using XPath positioning
Our Services
Odoo
Customization
Odoo
Migration
Support &
Maintenance
📞 Contact Us
WhatsApp:
Email:
Website: |
🌐 Follow Us📘 Facebook 📸 Instagram 💼 LinkedIn 🎥 YouTube |
© 2025 LucidBrainz | All Rights Reserved
Please log in to comment on this module