Z_DeleteCreditNote
Hi
I'm getting the following messages when trying to delete a Credit Note
INFORMATION Message : The number of stock movements to be deleted is: 5
INFORMATION Message : The custallocns record has been deleted
INFORMATION Message : The debtortranstaxes record has been deleted
INFORMATION Message : Deleted the credit note stock move taxesinfo
Database Error 1451 : SQL to delete the stock movement record failed with the message
Cannot delete or update a parent row: a foreign key constraint fails (`weberb_test`.`stockserialmoves`, CONSTRAINT `stockserialmoves_ibfk_1` FOREIGN KEY (`stockmoveno`) REFERENCES `stockmoves` (`stkmoveno`))
Database SQL Failure : The SQL that failed was
DELETE FROM stockmoves WHERE type=11 AND transno = '76'
Database Rollback Due to Error Above : Rolling Back Transaction OK
Anyway to bypass the key constraint?
Please no rant about not using this script deleting credit notes :-)
I'm currently working on an invoice editing feature that does things by the book:
1) auto-generating a full credit with returned goods
2) auto-clone the initial order with identical lots
3)
- if new order invoice issued, it becomes the revised order and tag the old one and new ones as revised/revision to clearly identify them as related
- if new order is discarded by user before being invoiced: the autogenerated credit note is deleted (that's why I'm using Z_DeleteCreditNote.php for: to put everything back to the original state and cancel my autogenerated Credit Note)
Thanks
|