Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0035428
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementminoralways2017-03-03 13:052017-03-20 15:11
ReporteraferrazView Statuspublic 
Assigned Toaferraz 
PrioritynormalResolutionfixedFixed in Version3.0PR17Q2
StatusclosedFix in branchFixed in SCM revision2d002737ee99
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tovmromanos
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0035428: Do not calculate Net Price and Net Amount outside triggers when creating new Order/Invoice with Price Including Taxes

DescriptionWhen 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.
Steps To Reproduce*
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 00210313.0MP13 closedmirurita Openbravo ERP Discounts are not applied properly for Price Including Taxes price lists 
related to defect 00321343.0PR16Q2 closedAtulOpenbravo Openbravo ERP Price Including taxes is not supported by the Purchasing Plan (Create Purchase Orders process) 
related to defect 00259323.0PR14Q3 closedAtulOpenbravo Openbravo ERP The Total Gross Amount of the Sales Order is wrong for non stockable BOM products udner some circumstancies 
related to defect 0021195 closedmirurita Openbravo ERP "create invoice from receipt" in goods receipt window when prices include taxes 
related to defect 0031788 closedAtulOpenbravo Openbravo ERP In a Purchase Order window the Price turns to 0 using a price list including taxes under some circumstancies 
related to defect 00235603.0MP24 closedpramakrishnan Openbravo ERP Insert Orphan Line when using Price List including taxes is not calculating Net Price properly 
related to design defect 0032265 closedaferraz Openbravo ERP [SER QA 1434] Taxes at document level are not properly calculated in some cases 
related to defect 0035453 closedmarvintm Retail Modules Method FinancialUtils.calculateNetFromGross has been deprecated and is currently used in the "Add Pack" process 
related to defect 0035475 newRetail Retail Modules Do not calculate Net Price and Net Amount outside triggers when creating new Order/Invoice with Price Including Taxes 
related to feature request 0035773 newTriage Finance Openbravo ERP Several improvements in FinancialUtils class 

-  Notes
(0094773)
aferraz (developer)
2017-03-06 18:33
edited on: 2017-03-07 17:14

Test plan 1:

- Login as F&B Admin:
- Set Tarifa de ventas price list as Price Includes Tax
- Create a Sales Order for Alimentos y Supermercados, S.A
- Add a line with Agua sin Gas 1L product, quantity: 1, gross price: 1.53, tax: IVA 18%.
- Book the order.
- Check following data:
  Total Gross Amount: 1.38 (1.53 - 0.15)
  Total Net Amount: 1.17 (1.30 - 0.17)
  Line 1 Gross Amount: 1.53
  Line 1 Net Amount: 1.30 (1.53 / 1.18)
  Line 2 Gross Amount: -0.15 (1.53 * 0.10)
  Line 2 Net Amount: -0.13 (1.30 * 0.10)

Test plan 2:

- Login as F&B Admin:
- Set Tarifa de ventas price list as Price Includes Tax
- Create a Sales Invoice for Alimentos y Supermercados, S.A
- Add a line with Agua sin Gas 1L product, quantity: 1, gross price: 1.53, tax: IVA 18%.
- Book the invoice.
- Check following data:
  Total Gross Amount: 1.38 (1.53 - 0.15)
  Total Net Amount: 1.17 (1.30 - 0.17)
  Line 1 Gross Amount: 1.53
  Line 1 Net Amount: 1.30 (1.53 / 1.18)
  Line 2 Gross Amount: -0.15 (1.53 * 0.10)
  Line 2 Net Amount: -0.13 (1.30 * 0.10)

Test plan 3:

- Login as F&B Admin:
- Set Tarifa de ventas price list as Price Includes Tax
- Create a product with Stocked = No and Bill of Materials = Yes.
- Add a record in Price tab for Tarifa de ventas price list and price = 0.
- Add a record in Bill of Materials tab for Agua sin Gas product.
- Click on Verify BOM button.
- Create a Sales Order for Alimentos y Supermercados, S.A
- Add a line with created product, quantity = 1 and tax = IVA 21%.
- Click on Explode button
- Check following data:
  Total Gross Amount: 1.53
  Total Net Amount: 1.26

Test plan 4:

- Login as F&B Admin:
- Set Tarifa Bebidas Alegres price list as Price Includes Tax
- Create a Purchase Order for Bebidas Alegres, S.L.
- Add a line with Cerveza Ale product, quantity: 3, gross price: 9.99, tax: IVA 21%.
- Book the order.
- Create a Goods Receipt for Bebidas Alegres, S.L.
- Click on Create Lines From and select created order
- Click on Complete
- Click on Generate Invoice from Receipt
- Check following data in created invoice:
  Total Gross Amount: 29.97
  Total Net Amount: 24.77

Test plan 5:

- Login as F&B Admin:
- Set Tarifa Bebidas Alegres price list as Price Includes Tax
- Create a record in Discounts and Promotions window for Price Adjustment type, from 01-01-2017 to 31-12-2017, Included Products = Only those defined, Fixed Unit Price = 73 and Min Quantity = 10
- Add a record in Products tab for Agua sin Gas.
- Create a Purchase Order for Bebidas Alegres, S.L.
- Click on Create Lines and select Agua sin Gas with Standard Price = 19 and Quantity = 20.
- Book the order.
- Check following data in created order:
  Total Gross Amount: 1460.00
  Total Net Amount: 1206.61
  Line Gross Price: 73.00
  Line Net Price: 60.33

Test plan 6:

- Login as F&B Admin:
- Set Tarifa Bebidas Alegres price list as Price Includes Tax
- Create a record in Discounts and Promotions window for Price Adjustment type, from 01-01-2017 to 31-12-2017, Included Products = Only those defined, Fixed Unit Price = 73 and Min Quantity = 10
- Add a record in Products tab for Agua sin Gas.
- Create a Purchase Order for Bebidas Alegres, S.L.
- Click on Create Lines and select Agua sin Gas with Standard Price = 19 and Quantity = 20.
- Book the order.
- Check following data in created order:
  Total Gross Amount: 1460.00
  Total Net Amount: 1206.61
  Line Gross Price: 73.00
  Line Net Price: 60.33

Test plan 7:

- Login as F&B Admin:
- Set Tarifa de ventas price list as Price Includes Tax
- Create RM Allow Orphan Line preference with "Y" value.
- Logout and login again.
- Create Return From Customer for Alimentos y Supermercados.
- Click on Insert Orphan Line and select product Agua sin Gas, Returned = 5, Price = 330 and Tax = IVA 21%.
- Check following data in created line:
  Line Gross Amount: 1650.00
  Line Net Amount: 1363.64 (1650.00 / 1.21)
  Line Gross Price: 330.00 (1650.00 / 5)
  Line Net Price: 272.73 (1363.64 / 5)

Test plan 8:

- Login as F&B Admin:
- Set Tarifa de ventas price list as Price Includes Tax.
- Create Sales Quotation for Alimentos y Supermercados.
- Add a line with Agua sin Gas 1L product, quantity: 9, gross price: 9.99, tax: IVA 21%.
- Book the order.
- Click on Create Order.
- Check following data in created Sales Order:
  Total Gross Amount: 80.92 ((9*9.99) - (9*9.99*0.10))
  Total Net Amount: 66.88 (80.92 / 1.21)

Test plan 9:

- Login as F&B Admin:
- Set Tarifa Bebidas Alegres price list as Price Includes Tax
- Create a record in Discounts and Promotions window for Price Adjustment type, from 01-01-2017 to 31-12-2017, Included Products = Only those defined, Discount = 50.00%
- Add a record in Products tab for Agua sin Gas.
- Create a Purchase Order for Bebidas Alegres, S.L.
- Add a line for Agua sin Gas product and quantity = 99.
- Book the order.
- Check following data in created order:
  Total Gross Amount: 87.12 (1.76 * 0.5 * 99)
  Total Net Amount: 72.00 (87.12 / 1.21)

(0094832)
hgbot (developer)
2017-03-08 13:34

Repository: erp/devel/pi
Changeset: 2d002737ee99169df4fb03ea8f76aee2a2d7869b
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Mar 08 10:08:26 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2d002737ee99169df4fb03ea8f76aee2a2d7869b [^]

Fixes issue 35428: Do not use C_GET_NET_PRICE_FROM_GROSS function

We avoid Net Price and Net Amount calculation outside triggers when creating new Order/Invoice lines with Price Including Taxes.
Also, we change use of C_GET_NET_PRICE_FROM_GROSS function with C_GET_NET_AMOUNT_FROM_GROSS in Order and Invoice callouts. Now, we get line net amount from line gross amount instead of getting line net price from line gross amount and then line net amount from line net price. Thus, we avoid precision loss.

---
M src-db/database/model/functions/C_INVOICE_POST.xml
M src-db/database/model/functions/C_ORDER_POST1.xml
M src-db/database/model/functions/MRP_PURCHASEORDER.xml
M src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml
M src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml
M src-db/database/model/functions/M_PROMOTION_ADJUSTMENT.xml
M src-db/database/model/functions/M_REQUISITION_CREATEPO.xml
M src/org/openbravo/common/actionhandler/OrderCreatePOLines.java
M src/org/openbravo/common/actionhandler/SRMOPickEditLines.java
M src/org/openbravo/erpCommon/ad_actionButton/CopyFromInvoice.java
M src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java
M src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
M src/org/openbravo/erpCommon/ad_actionButton/RMInsertOrphanLine.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
M src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
M src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java
M src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql
M src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java
M src/org/openbravo/financial/FinancialUtils.java
---
(0094886)
hgbot (developer)
2017-03-09 18:25

Repository: erp/pmods/org.openbravo.materialmgmt.freightmgmt
Changeset: 305068c683c8a7207aba955802708d107199de93
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Mar 09 18:22:21 2017 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.materialmgmt.freightmgmt/rev/305068c683c8a7207aba955802708d107199de93 [^]

Related to issue 35428: Do not use C_GET_NET_PRICE_FROM_GROSS function

---
M src/org/openbravo/materialmgmt/freightmgmt/AvailableFreightsDS.java
M src/org/openbravo/materialmgmt/freightmgmt/SelectFreightHandler.java
---
(0094887)
hgbot (developer)
2017-03-09 18:48

Repository: erp/pmods/org.openbravo.module.resources
Changeset: 0a92293a8d0159108ea4a48dce3a1080b95b28ba
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Mar 09 18:48:27 2017 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.module.resources/rev/0a92293a8d0159108ea4a48dce3a1080b95b28ba [^]

Related to issue 35428: Do not use C_GET_NET_PRICE_FROM_GROSS function

---
M src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
M src/org/openbravo/module/resources/calendar/ReservationUtilities.java
---
(0094888)
hgbot (developer)
2017-03-09 18:59

Repository: erp/pmods/org.openbravo.contract.services
Changeset: 3b94e730043475a1d312da8d1eb5a32a0eda30db
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Mar 09 18:58:36 2017 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/3b94e730043475a1d312da8d1eb5a32a0eda30db [^]

Related to issue 35428: Do not use C_GET_NET_PRICE_FROM_GROSS function

---
M src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
M src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java
---
(0094889)
hgbot (developer)
2017-03-09 19:33

Repository: erp/pmods/org.openbravo.contract.services
Changeset: e5d641089f92a363cecb2d37d6334a69d5d91293
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Mar 09 19:33:11 2017 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/e5d641089f92a363cecb2d37d6334a69d5d91293 [^]

Related to issue 35428: Do not use C_GET_NET_PRICE_FROM_GROSS function

---
M src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java
---
(0094892)
aferraz (developer)
2017-03-10 08:53

Pending to update dependency of org.openbravo.materialmgmt.freightmgmt and org.openbravo.contract.services (spm2 branch) modules to core 17Q2.
(0095279)
hudsonbot (developer)
2017-03-15 20:21

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test
(0095426)
vmromanos (developer)
2017-03-20 15:11

Code review OK

- Issue History
Date Modified Username Field Change
2017-03-03 13:05 aferraz New Issue
2017-03-03 13:05 aferraz Assigned To => Triage Finance
2017-03-03 13:05 aferraz Modules => Core
2017-03-03 13:05 aferraz Triggers an Emergency Pack => No
2017-03-03 13:06 aferraz Proposed Solution updated
2017-03-03 13:06 aferraz Relationship added related to 0032265
2017-03-03 13:08 aferraz File Added: 35428.diff
2017-03-06 18:33 aferraz Note Added: 0094773
2017-03-06 18:34 aferraz Note Edited: 0094773 View Revisions
2017-03-06 18:41 aferraz Relationship added related to 0021031
2017-03-06 18:45 aferraz Relationship added related to 0032134
2017-03-06 18:47 aferraz Relationship added related to 0025932
2017-03-06 18:51 aferraz Relationship added related to 0021195
2017-03-06 19:11 aferraz Note Edited: 0094773 View Revisions
2017-03-06 19:25 aferraz Note Edited: 0094773 View Revisions
2017-03-07 10:51 aferraz Relationship added related to 0031788
2017-03-07 11:01 aferraz Note Edited: 0094773 View Revisions
2017-03-07 12:35 aferraz Note Edited: 0094773 View Revisions
2017-03-07 12:40 aferraz Relationship added related to 0023560
2017-03-07 12:49 aferraz Note Edited: 0094773 View Revisions
2017-03-07 16:27 aferraz Note Edited: 0094773 View Revisions
2017-03-07 17:14 aferraz Note Edited: 0094773 View Revisions
2017-03-08 13:34 hgbot Checkin
2017-03-08 13:34 hgbot Note Added: 0094832
2017-03-08 13:34 hgbot Status new => resolved
2017-03-08 13:34 hgbot Resolution open => fixed
2017-03-08 13:34 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2d002737ee99169df4fb03ea8f76aee2a2d7869b [^]
2017-03-08 13:35 aferraz Assigned To Triage Finance => aferraz
2017-03-08 13:35 aferraz File Deleted: 35428.diff
2017-03-08 13:36 aferraz Proposed Solution updated
2017-03-08 16:43 aferraz Relationship added related to 0035453
2017-03-09 18:25 hgbot Checkin
2017-03-09 18:25 hgbot Note Added: 0094886
2017-03-09 18:48 hgbot Checkin
2017-03-09 18:48 hgbot Note Added: 0094887
2017-03-09 18:59 hgbot Checkin
2017-03-09 18:59 hgbot Note Added: 0094888
2017-03-09 19:33 hgbot Checkin
2017-03-09 19:33 hgbot Note Added: 0094889
2017-03-10 08:53 aferraz Note Added: 0094892
2017-03-10 09:10 aferraz Type design defect => defect
2017-03-10 09:16 aferraz Relationship added related to 0035475
2017-03-15 20:21 hudsonbot Checkin
2017-03-15 20:21 hudsonbot Note Added: 0095279
2017-03-20 15:11 vmromanos Review Assigned To => vmromanos
2017-03-20 15:11 vmromanos Note Added: 0095426
2017-03-20 15:11 vmromanos Status resolved => closed
2017-03-20 15:11 vmromanos Fixed in Version => 3.0PR17Q2
2017-04-12 14:07 vmromanos Relationship added related to 0035773


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker