The test that you have to do is with a new production order and not using the old production orders because they may have several duedates.
To work always with new and old PO you need this query:
IF @OBJECT_TYPE = '202' AND @TRANSACTION_TYPE = 'U'
BEGIN
IF EXISTS(
SELECT top 1 'True' from
OWOR T0
WHERE T0.DueDate <> (select top 1 T1.Duedate from Awor T1 where T0.DocEntry = T1.DocEntry order by T1.LogInstanc desc) AND (T0.docentry = @list_of_cols_val_tab_del))
BEGIN
SELECT @ERROR = 1, @ERROR_MESSAGE = 'you are not allowed to change due date.'
END
END