Thank you for writing this bug post.
I think I found a quite okey solution, around line 679
if(empty($data['product_subtotal_discount'])){
$data['product_subtotal_discount'] = 0.0;
} else {
$itemDiscount = $data['product_subtotal_discount'];
if($itemDiscount<0.0){
$itemDiscount = $itemDiscount * (-1);
}
if($daTax and VirtueMartModelOrders::isNotEmptyDec($data,'product_basePriceWithTax') and VirtueMartModelOrders::isNotEmptyDec($data,'product_final_price')){
$itemDiscount = $data['product_basePriceWithTax'] - $data['product_final_price'];
} else if(!$daTax and VirtueMartModelOrders::isEmptyDec($data,'product_subtotal_discount') and VirtueMartModelOrders::isNotEmptyDec($data,'product_final_price')){
$itemDiscount = round($data['product_item_price'] - $data['product_final_price'] + $data['product_final_price'] * $taxValue/(100 + $taxValue), $rounding);
} else {
$itemDiscount = $itemDiscount/$quantity;
}
}
The problem is, that it overwrites now the discount. The correct solution would be a dropdown with a discount to select, and a textfield with an override value. The thing is, atm we have only a value.
But there is at trick, so you can still set a discount and let vm calculate the baseprice. Just delete the baseprice with tax.