Is it possible to calculate Sales Order Amount using Total Weight instead of Qty × Rate in ERPNext?

Description

Hi Everyone,

I am working on an ERPNext customization where each Sales Order Item has the following custom fields:

  • Weight per Unit

  • Weight UOM

  • Total Weight (calculated automatically)

By default, ERPNext calculates:

Amount = Qty × Rate

My requirement is different.

If the item is sold based on weight, I want ERPNext to calculate:

Amount = Total Weight × Rate

instead of the standard Qty × Rate calculation.

The custom calculation works, but ERPNext’s standard calculate_taxes_and_totals() recalculates the amount and overwrites the custom value.

My questions are:

  1. Is there a standard ERPNext/Frappe way to calculate the Amount using Total Weight instead of Quantity?

  2. Does ERPNext provide any built-in feature or configuration to support weight-based pricing, or is custom development required?

  3. Has anyone implemented a similar weight-based pricing workflow?

  4. What is the recommended approach to avoid conflicts with the standard amount calculation (calculate_taxes_and_totals())?

Any suggestions, best practices, or references to existing ERPNext implementations would be greatly appreciated.

Thank you!

I feel like this is the same thing as when you have pricing based on UOM of weight.

Why can’t you use QTY=Weight (in KG, LBS, OZ, etc)?

You can also incorporate UOM conversion where 1 unit = 2.5Kilo as an example.

Make the item UiOM as kg. Write a client script to update qty from item master weight per unit whever an item is added.