
Circular recomputation and rounding drift in Odoo
The Real Problem In ERP systems, it’s common to have two fields that represent the same value in different units — for example, a purchase price in company currency and the same price in USD. Both fields are editable. Both must stay synchronized. For simplicity, let’s assume the conversion logic looks like this: purchase_price_usd = round ( purchase_price / rate , 2 ) purchase_price = round ( purchase_price_usd * rate , 2 ) The formulas here are intentionally simplified. In real systems you would use proper currency utilities, precision handling, and framework helpers. The goal of this example is to demonstrate the recomputation problem, not currency implementation details. Now consider a basic case: rate = 3 user enters purchase_price = 10 The system calculates: purchase_price_usd = round ( 10 / 3 , 2 ) = 3.33 purchase_price = round ( 3.33 * 3 , 2 ) = 9.99 Now the original value changes from 10 to 9.99. Mathematically, this is correct. From a user perspective, it is not. The user ente
Continue reading on Dev.to
Opens in a new tab




