I have an inactive stock item that have not been use for so long (>2 years) and the known transactions has already been archived. My customer would like to remove it from the system. But we encounter this error as attached. So I attempt to delete it programmatically but receive the same error.
How can I get all of the transactions related to this stock item and delete it programmatically?