Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035475Retail ModulesWeb POSpublic2017-03-10 09:152017-03-10 09:16
aferraz 
Retail 
normalminorhave not tried
newopen 
30Professional Appliance
 
 
No
0035475: Do not calculate Net Price and Net Amount outside triggers when creating new Order/Invoice with Price Including Taxes
When creating new C_Order or C_Invoice records using Price Including Taxes from any PL/SQL or Java code, PriceStd, PriceList, PriceLimit, PriceActual, TaxBaseAmt and LineNetAmt should not be calculated for lines, as they will be calculated in C_OrderLine_Trg or C_InvoiceLine_Before_Trg triggers.

In case we need to calculate them, instead of using C_Get_Net_Price_From_Gross function to calculate net price from gross price, we need to use C_Get_Net_Amount_From_Gross function to calculate net amount from gross amount and then net price from net amount.
Doing a grep in Retail modules we see several references to C_GET_NET_PRICE_FROM_GROSS function:

openbravo@por0965:~/workspace/pi_retail/openbravo/modules$ grep -ri "C_GET_NET_PRICE_FROM_GROSS" .
./org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/js/data/dataordertaxes.js: // the database function c_get_net_price_from_gross
./org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/js/data/dataordertaxes.js: //We follow the same formula of function c_get_net_price_from_gross to compute the discounted net
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_DISCOUNT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision,v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_SAME_PRODUCT.xml: v_newNetLine := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_GIFT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_GIFT.xml: v_newNetAmt := c_get_net_price_from_gross(v_tax, v_newGrossAmt,v_newGrossAmt, p_priceprecision, 1);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_GIFT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_PACK.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_PACK.xml: v_newNetAmt := c_get_net_price_from_gross(v_tax, v_newGrossAmt,v_newGrossAmt, p_priceprecision, 1);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
./org.openbravo.retail.discounts/src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml: v_newNetPrice := c_get_net_price_from_gross(v_tax, v_newGrossAmt, v_newGrossAmt, p_priceprecision, v_qty);
No tags attached.
related to defect 0035428 closed aferraz Openbravo ERP Do not calculate Net Price and Net Amount outside triggers when creating new Order/Invoice with Price Including Taxes 
related to design defect 0032265 closed aferraz Openbravo ERP [SER QA 1434] Taxes at document level are not properly calculated in some cases 
Issue History
2017-03-10 09:15aferrazNew Issue
2017-03-10 09:15aferrazAssigned To => Retail
2017-03-10 09:15aferrazTriggers an Emergency Pack => No
2017-03-10 09:16aferrazRelationship addedrelated to 0035428
2017-03-10 09:16aferrazRelationship addedrelated to 0032265

There are no notes attached to this issue.