Fixes issue 31550: Net Unit Price is changed after saving the invoice line
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Tue, 01 Dec 2015 19:06:20 +0100
changeset 28093 e867bcaa1cc6
parent 28092 dd7a95752920
child 28094 e875b083dc70
child 28095 e32a6dfe59e6
Fixes issue 31550: Net Unit Price is changed after saving the invoice line

Update call to C_GET_NET_PRICE_FROM_GROSS from C_ORDERLINE_TRG and C_INVOICELINE_BEFORE_TRG to do it with gross_unit_price * qtyinvoiced and taxbaseamt.
src-db/database/model/triggers/C_INVOICELINE_BEFORE_TRG.xml
src-db/database/model/triggers/C_ORDERLINE_TRG.xml
--- a/src-db/database/model/triggers/C_INVOICELINE_BEFORE_TRG.xml	Wed Dec 02 19:06:21 2015 +0000
+++ b/src-db/database/model/triggers/C_INVOICELINE_BEFORE_TRG.xml	Tue Dec 01 19:06:20 2015 +0100
@@ -123,7 +123,7 @@
         v_PriceActual := v_NetActual / :new.qtyinvoiced;     
       ELSE
         -- Regular taxes
-        v_PriceActual := C_GET_NET_PRICE_FROM_GROSS(:new.c_tax_id, :new.line_gross_amount, :new.line_gross_amount, v_price_prec, :NEW.qtyinvoiced);    
+        v_PriceActual := C_GET_NET_PRICE_FROM_GROSS(:new.c_tax_id, :new.gross_unit_price * :new.qtyinvoiced, :new.taxbaseamt, v_price_prec, :new.qtyinvoiced);
         v_NetActual := ROUND(:new.Qtyinvoiced * v_PriceActual, v_std_Prec);
       END IF;      
       
--- a/src-db/database/model/triggers/C_ORDERLINE_TRG.xml	Wed Dec 02 19:06:21 2015 +0000
+++ b/src-db/database/model/triggers/C_ORDERLINE_TRG.xml	Tue Dec 01 19:06:20 2015 +0100
@@ -227,7 +227,7 @@
       v_PriceActual := ROUND(v_NetActual / :new.qtyordered, v_price_prec);     
     ELSE
       -- Regular taxes
-      v_PriceActual := C_GET_NET_PRICE_FROM_GROSS(:new.c_tax_id, :new.line_gross_amount, :new.taxbaseamt, v_price_prec, :NEW.qtyordered);    
+      v_PriceActual := C_GET_NET_PRICE_FROM_GROSS(:new.c_tax_id, :new.gross_unit_price * :new.qtyordered, :new.taxbaseamt, v_price_prec, :new.qtyordered);
       v_NetActual := ROUND(:new.QtyOrdered * v_PriceActual, v_Prec);
     END IF;