Dynamic Mass-to-Volume Conversion for Oil and Gas Products with Varying Density in ERPNext

Hello ERPNext community,

I’m in the process of implementing ERPNext for a company that buys and sells oil and gas products such as petrol, diesel, and other similar commodities. We face a unique challenge with converting mass (tonnes) to volume (liters) because the density of these products fluctuates based on factors like temperature, composition, etc., and cannot be predicted in advance. As a result, managing the correct unit conversion factor across various documents like quotations, sales orders, and delivery notes is complex.

The Process We Follow:

  1. Contract Creation: Our company and the buyer sign a contract, which forms the basis for all future orders. From this contract, we create a quotation for the buyer.
  2. Sales Order Creation: The buyer then places one or more sales orders based on the quotation. A single contract might generate multiple sales orders over time, depending on the total value of the quotation.
  3. Delivery Note Creation: For each sales order, we create a delivery note that represents the physical delivery of goods. At the time of delivery, we can determine the actual density of the oil products. However, the density value was not available when the quotation was originally created, and this leads to discrepancies when we try to apply the correct mass-to-volume conversion.

The Core Issue:

  • The density value, which is essential for converting tonnes to liters, is only known at the time of delivery, but it is needed for accurate unit conversion when creating both the quotation and the sales order.
  • If we create both the sales order and delivery note at the same time, we can use the same density value for both, but how do we apply the same density retroactively to the quotation, since the density is not known at that stage?

What I’ve Tried So Far:

  • I attempted to add a custom density field to the sales order and delivery note and used a script to change the unit conversion (from mass to volume) based on the density.
  • However, this approach doesn’t work because the quotation also needs the same conversion factor, and we do not have the density at the time the quotation is created. This causes inconsistencies in the unit conversion factor between the quotation, sales order, and delivery note.

Has anyone encountered a similar issue when dealing with fluctuating density for mass-to-volume conversions? If so, could you please share your experience or suggest a solution that would allow me to handle these conversions accurately across all documents in ERPNext?

Any advice or solutions would be greatly appreciated!

Thank you in advance!

1 Like

@maliknaqibullah
Why you don’t use a field like Estimated Density instead of the actual density during the initial stages (Quotation and Sales Order)…?? This way, you can provide approximate calculations based on the estimated density.
Then in the final Delivery Note you can update it with the Actual Density value to ensure accurate volume calculations.

1 Like