Hi Nikunj,
try with this SP
If @object_type='13' and @transaction_type='U'
BEGIN
If Exists (SELECT T0.DocEntry FROM OINV T0
INNER JOIN INV1 T1 ON T1.DOCENTRY = T0.docENTRY
WHERE T0.DOCENTRY = @list_of_cols_val_tab_del and T0.UserSign2 not in ('17','12') )
BEGIN
Select @error = -1,
@error_message = 'Not authorised to update'
End
End
If you are creating invoice based on delivery then try this SP as well :-
If @object_type='13' and @transaction_type='U'
BEGIN
If Exists (SELECT T0.DocEntry FROM OINV T0
INNER JOIN INV1 T1 ON T1.DOCENTRY = T0.docENTRY
INNER JOIN ODLN T2 ON T1.BaseEntry = T2.DocEntry
INNER JOIN DLN1 T3 ON T2.DocEntry = T3.DocEntry
WHERE T0.DOCENTRY = @list_of_cols_val_tab_del and T1.Price <> T3.Price
and
T0.UserSign2 not in ('17','12') )
BEGIN
Select @error = -1,
@error_message = 'Not authorised to update'
End
End
Change the Usersign according to your usersigns in both SP.
Thanks,
Harshal