Topic: Voiding purchase order deliveries in 2.4.1
In 2.3, one can void a PO delivery by voiding the invoice and then voiding the PO delivery. The voiding of the invoice clears quantity in supp_inv_items. This allows the void of the PO delivery to proceed because it calls:
function exists_grn_on_invoices($grn_batch)
{
$sql = "SELECT ".TB_PREF."supp_invoice_items.id FROM ".TB_PREF."supp_invoice_items,".TB_PREF."grn_items
WHERE ".TB_PREF."supp_invoice_items.grn_item_id=".TB_PREF."grn_items.id
AND quantity != 0
AND grn_batch_id=".db_escape($grn_batch);
$result = db_query($sql, "Cannot query GRNs");
return (db_num_rows($result) > 0);
}
and disallows the void only if "quantity != 0".
This code changed in 2.4.1. It now calls exists_grn() which simply checks for a grn_batch entry, and if it exists it disallows the void. Yet the grn_batch entry still exists after an invoice has been voided and thus returns the error:
The entered transaction does not exist or cannot be voided.
To test this, create a direct supplier invoice in both 2.3 and 2.4.1, void the invoice and then void the PO Delivery.