Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
Purchase (purchase)
• Invoicing (account) • Discuss (mail) |
Lines of code | 49 |
Technical Name |
an_purchase_price_subtotal_sync |
License | AGPL-3 |
Website | http://www.odoosa.net |
Versions | 16.0 17.0 18.0 |
Purchase Price Subtotal Sync
Bidirectional Synchronization Between Price Unit and Subtotal

Key Features

- Automatic update of price_subtotal when price_unit or product_qty changes
- Automatic recalculation of price_unit when price_subtotal is manually updated
- Real-time bidirectional synchronization for accurate pricing
- Error handling for scenarios with zero quantity
- Seamless integration with Odoo's native Purchase module
How It Works

- Update Price Unit: Enter a new price unit, and the subtotal will automatically update based on the quantity.
- Update Quantity: Change the product quantity, and the subtotal will automatically update while keeping the unit price constant.
- Update Subtotal: Manually change the subtotal, and the unit price will automatically recalculate based on the quantity.
Business Benefits
For Procurement Teams
- Faster data entry when creating purchase orders
- Greater flexibility in price negotiations
- Reduced manual calculation errors
- Option to work with total costs or unit prices based on preference
For Finance Teams
- Improved accuracy in purchase cost accounting
- Easier reconciliation of purchase orders
- Better cost control and visibility
- Streamlined approval processes
Technical Details
This module extends the purchase.order.line
model to enable bidirectional synchronization:
- Overrides the
price_subtotal
field to make it writable - Implements the
_inverse_price_subtotal
method to update unit price when subtotal changes - Uses
@api.onchange
decorators to ensure real-time updates in the UI - Implements proper error handling for edge cases
Compatibility
Compatible with Odoo 18.0 Community and Enterprise Editions
Support
For any questions or support, please contact:
Ahmed Nour
Email: ahmednour@outlook.com
Website: www.odoosa.net
Please log in to comment on this module