Hi. I have seen that this issue was resolved (bug 343) and implemented in 2.3.4, but only in the sales module. I have copied the concept to the purchasing module, as I have had suppliers send me invoices with negative items (even though the total invoice amount is positive). Pretty much exactly what is explained above.
The patch is below, but I can send it somewhere else if needed. This is my first code submission, so please let me know if there is a better process to follow.
diff -up ./po_entry_items.php.bug343 ./po_entry_items.php
--- ./po_entry_items.php.bug343 2011-07-24 22:24:38.000000000 +0200
+++ ./po_entry_items.php 2011-07-24 22:29:03.000000000 +0200
@@ -209,6 +209,9 @@ function handle_cancel_po()
function check_data()
{
+ global $allow_negative_prices;
+ $is_inventory_item = is_inventory_item($_POST['stock_id']);
+
if(!get_post('stock_id_text', true)) {
display_error( _("Item description cannot be empty."));
set_focus('stock_id_edit');
@@ -225,7 +228,7 @@ function check_data()
return false;
}
- if (!check_num('price', 0))
+ if (!check_num('price', 0) && (!$allow_negative_prices || $is_inventory_item))
{
display_error(_("The price entered must be numeric and not less than zero."));
set_focus('price');