Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0013493 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Openbravo ERP] 07. Sales management | minor | always | 2010-06-01 13:50 | 2010-06-30 12:16 | |||
Reporter | psarobe | View Status | public | |||||
Assigned To | harikrishnan | |||||||
Priority | high | Resolution | fixed | Fixed in Version | ||||
Status | closed | Fix in branch | pi | Fixed in SCM revision | b810b1c73ea0 | |||
Projection | none | ETA | none | Target Version | 2.50MP21 | |||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | 2.50MP18 | SCM revision | ||||||
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 | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
![]() |
|
(0028670) hgbot (developer) 2010-06-22 14:24 |
Repository: erp/devel/pi Changeset: b810b1c73ea0b07af1798a8e2452f397b87e1c60 Author: Harikrishnan Raja <harikrishnan.raja <at> openbravo.com> Date: Tue Jun 22 17:54:14 2010 +0530 URL: http://code.openbravo.com/erp/devel/pi/rev/b810b1c73ea0b07af1798a8e2452f397b87e1c60 [^] Fixes Issue 13493: Sales order: Discounts are calculated without taking into account currency precisions. --- M src-db/database/model/functions/C_ORDER_POST1.xml --- |
(0028673) harikrishnan (viewer) 2010-06-22 14:28 |
Steps to reproduce: Follow the above to reproduce the issue. And in the Database Query select c_order_id from c_order where documentno='document no created' select * from c_orderline where c_order_id='id got from the above result' Root Cause: *Round off is not done to the discount amount. Impact: *Their is no impact because of this change set,because only the round off is done according to the currency precision. |
(0028892) hudsonbot (viewer) 2010-06-30 12:16 |
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated: Changeset: http://code.openbravo.com/erp/devel/main/rev/b810b1c73ea0 [^] Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/0670375d782d [^] Tests: http://builds.openbravo.com/view/int/ [^] OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.17726.obx [^] |
![]() |
|||
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 |
Copyright © 2000 - 2009 MantisBT Group |