Sales order line status is not getting considered through groovy extensions
Hi All,
We have a requirement to validate that all lines within a sales order share the same warehouse. If different lines are assigned to different warehouses, the script should raise a validation error. This ensures that each sales order is fulfilled from a single warehouse.
We can achieve this using Groovy extensions. For example, if a sales order contains three lines, and two lines have the warehouse 'ABC' while the third line has the warehouse 'XYZ', the Groovy script will trigger an error message during submission:
"One or more lines have different warehouses."
In the script, the logic compares the warehouse of the first line with each subsequent line in the sales order to ensure they match.