Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0013493 | Openbravo ERP | 07. Sales management | public | 2010-06-01 13:50 | 2010-06-30 12:16 |
Reporter | psarobe | ||||
Assigned To | harikrishnan | ||||
Priority | high | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | 2.50MP18 | ||||
Target Version | 2.50MP21 | Fixed in Version | |||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | No | ||||
Web browser | |||||
Modules | Core | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0013493: Sales order: Discounts are calculated without taking into account currency precisions | ||||
Description | Discounts are calculated without taking into account currency precisions. In the C_ORDER_POST stored procedure you can find this code for calculating the discount: IF(Cur_COrderDiscount.CASCADE='Y') THEN v_Discount:=(-1) * Cur_TaxDiscount.LINENETAMT * v_CumDiscount; ELSE v_Discount:=(-1) * Cur_TaxDiscount.LINENETAMT * Cur_COrderDiscount.Discount/100; END IF; Later on the paramater v_Discount is used for filling the values pricelist, priceactual, pricelimit, linenetamt as you can see in this part of code: INSERT INTO c_orderline ( c_orderline_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, c_order_id, line, c_bpartner_id, c_bpartner_location_id, dateordered, datepromised, datedelivered, dateinvoiced, description, m_product_id, m_warehouse_id, directship, c_uom_id, qtyordered, qtyreserved, qtydelivered, qtyinvoiced, m_shipper_id, c_currency_id, pricelist, priceactual, pricelimit, linenetamt, discount, freightamt, c_charge_id, chargeamt, c_tax_id, s_resourceassignment_id, ref_orderline_id, m_attributesetinstance_id, isdescription, quantityorder, m_product_uom_id, m_offer_id, pricestd, C_ORDER_DISCOUNT_ID ) VALUES ( v_OrderLine, v_Client_ID, v_Org_ID, 'Y', TO_DATE(NOW()), v_UpdatedBy, TO_DATE(NOW()), v_UpdatedBy, v_Record_ID, v_OrderLineSeqNo, NULL, NULL, TO_DATE(NOW()), TO_DATE(NOW()), TO_DATE(NOW()), TO_DATE(NOW()), Cur_COrderDiscount.NAME, Cur_COrderDiscount.M_PRODUCT_ID, v_M_Warehouse_ID, 'N', Cur_COrderDiscount.C_UOM_ID, 1, 0, 0, 0, NULL, v_c_currency_id, v_Discount, v_Discount, v_Discount, v_Discount, 0, 0, NULL, NULL, Cur_TaxDiscount.C_TAX_ID, NULL, NULL, NULL, 'N', NULL, NULL, NULL, v_Discount, NULL ); What it happens is that later on there is a trigger c_orderline_trg that rounds the linetamt to the standard precision of the currency which is correct so finally there is an inconsistency between the prices and the line net amount. Having this situation: pricelist, priceactual, pricelimit=-7.79688000000000000000000 and the linetamt=-7.8 So the solution would be to round the v_discount to the standard precision of the currency similar to what it's done in the trigger. Standard precision not priceprecision To verify this you need to connect to the database | ||||
Steps To Reproduce | 1. Login as Openbravo/openbravo 2. Change the user preferences to Main and Openbravo Admin role 3. Go to Master data management->Business partner-> Select Mafalda 4. Move to Discount tabs and select in this order: 4.1 Discount 15%. Check Apply in order 4.2 Discount 7%. Check Cascade and Apply in order 5. Go to Sales order window and click new. Select Mafalda. Save 6. Move to lines and select Hat and quantity 2 7. The same for hat and quantity 2 8. Complete the sales order Connect to the database and see that pricelist, priceactual, pricelimit=-7.79688000000000000000000 and the linetamt=-7.8 for the newly discount lines It should be -7.8 | ||||
Proposed Solution | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2010-06-01 13:50 | psarobe | New Issue | |||
2010-06-01 13:50 | psarobe | Assigned To | => adrianromero | ||
2010-06-01 13:50 | psarobe | OBNetwork customer | => No | ||
2010-06-01 13:51 | psarobe | Status | new => scheduled | ||
2010-06-01 13:51 | psarobe | fix_in_branch | => pi | ||
2010-06-22 14:22 | harikrishnan | Assigned To | adrianromero => harikrishnan | ||
2010-06-22 14:24 | hgbot | Checkin | |||
2010-06-22 14:24 | hgbot | Note Added: 0028670 | |||
2010-06-22 14:24 | hgbot | Status | scheduled => resolved | ||
2010-06-22 14:24 | hgbot | Resolution | open => fixed | ||
2010-06-22 14:24 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/b810b1c73ea0b07af1798a8e2452f397b87e1c60 [^] | ||
2010-06-22 14:28 | harikrishnan | Note Added: 0028673 | |||
2010-06-24 12:23 | sureshbabu | Note Added: 0028734 | |||
2010-06-24 12:23 | sureshbabu | Status | resolved => closed | ||
2010-06-24 12:31 | sureshbabu | Note Deleted: 0028734 | |||
2010-06-25 00:00 | anonymous | sf_bug_id | 0 => 3021057 | ||
2010-06-30 12:16 | hudsonbot | Checkin | |||
2010-06-30 12:16 | hudsonbot | Note Added: 0028892 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|