Hi ERPNext Community,
I am planning to develop a custom weight-based pricing module in ERPNext and would like feedback on the design approach.
Business Scenario
Many products are managed and stocked in Nos, but pricing is based on weight (Kg). Each item has a fixed Weight Per Unit.
Example:
Item: Pipe
Weight Per Unit: 28.2 Kg
Quantity: 10 Nos
Total Weight:
10 × 28.2 = 282 Kg
Requirement
The system should support two pricing modes.
Scenario A – User enters Rate per Kg
Example:
Rate per Kg = 133
System automatically calculates:
Rate per Nos = 28.2 × 133 = 3750.60
Total Weight = 10 × 28.2 = 282 Kg
Amount = 10 × 3750.60 = 37506.00
Scenario B – User enters Rate per Nos
Example:
Rate per Nos = 3750.60
System automatically calculates:
Rate per Kg = 3750.60 ÷ 28.2 = 133
Total Weight = 10 × 28.2 = 282 Kg
Amount = 10 × 3750.60 = 37506.00
Proposed Fields
Transaction Item Table:
• Weight Per Unit
• Total Weight
• Rate Per Kg
• Rate Per Nos
• Pricing Mode (Rate/Kg or Rate/Nos)
System Logic
If user enters Rate Per Kg:
Rate Per Nos = Weight Per Unit × Rate Per Kg
If user enters Rate Per Nos:
Rate Per Kg = Rate Per Nos ÷ Weight Per Unit
Total Weight = Qty × Weight Per Unit
Amount = Qty × Rate Per Nos
Scope
This functionality should work consistently across:
Sales Flow:
• Sales Order
• Delivery Note
• Sales Invoice
Purchase Flow:
• Purchase Order
• Purchase Receipt
• Purchase Invoice
Questions
-
Has anyone implemented a similar weight-based pricing module in ERPNext?
-
Is there any existing ERPNext marketplace app or open-source solution available?
-
What would be the best implementation approach:
• Server Scripts
• Client Scripts
• Custom App
• Extend Doctype Class
• Controller Override -
How should Rate Per Kg and Rate Per Nos be synchronized without causing ERPNext pricing or tax calculation issues?
-
Are there any recommended practices for carrying custom pricing fields through:
Sales Order → Delivery Note → Sales Invoice
Purchase Order → Purchase Receipt → Purchase Invoice -
Is this approach compatible with ERPNext standard tax, valuation, and accounting calculations?
Environment:
• ERPNext v15 / v16
• Frappe Framework v15 / v16
Any suggestions, implementation examples, GitHub repositories, or architecture recommendations would be greatly appreciated.
Thank you.