Hello everyone,
I am configuring ERPNext for our procurement workflow and would appreciate some guidance.
Goal
We want to use Material Request (Purchase Request) with pricing, so that:
-
Each Material Request Item has:
-
Rate (Unit Price)
-
Amount (Qty × Rate)
-
-
Material Request shows a Total Amount.
-
When creating a Purchase Order from a Material Request, the Rate and Amount values are automatically carried over to the PO.
What I Tried
-
Created Custom Fields:
-
On Material Request Item:
-
custom_rate(Currency) -
custom_amount(Currency)
-
-
On Material Request:
custom_total_amount(Currency)
-
-
Tried Client Script to calculate:
-
custom_amount = qty * custom_rate -
Sum all rows into
custom_total_amount
-
Problem
After adding scripts and custom fields, I started getting server errors when opening or creating Material Requests:
TypeError: '<' not supported between instances of 'NoneType' and 'int'
Field workflow_state not found
Even after disabling/deleting the scripts and custom fields, the errors persisted.
Material Request was working correctly before these changes.
Questions
-
Is there a recommended / standard way in ERPNext to support pricing in Material Request?
-
Should Rate and Amount be added via:
-
Custom Fields?
-
Property Setter?
-
Server Script?
-
-
What is the correct approach to map these values from Material Request → Purchase Order?
-
How can I safely clean up or revert broken customizations causing server errors?
Any advice, examples, or documentation would be greatly appreciated.
Thank you!