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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0042092
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 04. Warehouse managementmajoralways2019-10-22 14:292019-12-12 23:01
ReportergorkaionView Statuspublic 
Assigned Tomarkmm82 
PriorityhighResolutionfixedFixed in Version3.0PR20Q1
StatusclosedFix in branchFixed in SCM revision2e969cbadcac
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0042092: Unbalance posting when adjusting a return receipt

DescriptionWhen a Goods Receipt Return is adjusted a balance in Warehouse Differences and Invoice Price Variance account is generated.

The Goods Receipt Returns are valued with the average cost valid on the moment they are generated. When they are invoiced a Matched Invoice record is created, if the invoice price and the average cost are different a balance in the Invoice Price Variance is created.

If later by some adjustment the Average Cost is changed the unit cost of the goods receipt return is also adjusted. But the posting of this adjustment is done on the Warehouse Differences account instead of the Invoice Price Variance.
Steps To Reproduce1. Create a new product Test in F&B España. Purchase Price 20, Sales Price 25.
   Navigate to Accounting tab and set Invoice Price Variance to 99904 - Diferencias entre el coste del producto y el precio de la fra
2. Go to General Ledger Configuration. Select "F&B España, S.A. US/A/Euro" ledger and ensure that in Active Tables the tables related to Receipts, Matched Invoices and Cost Adjustments are active.
3. Create a new Purchase Order (PO01):
- Product Test, Quantity 10units, Price 10EUR
- Create the Receipt and the Invoice.
5. Create a new Purchase Order (PO02):
- Product Test, Quantity 10units, Price 20EUR
- Create the Receipt and the Invoice.
6. Create a Return to Vendor.
- Select the line related to PO02 order and return it completely.
- Set the price to 20EUR
- Create the Return to Vendor Receipt and the negative Purchase Invoice.
7. Create a Sales Order
- Product Test, Quantity 5 units, Price 25EUR.
- Create the Shipment and Invoice.
8. Ensure that the Costing Background process is executed and check that:
- The average cost after PO02 is 15EUR/unit
- The return receipt is valued as 150EUR
- The shipment is valued at 75EUR
9. Run the Trial Balance for:
- Organization: F&B España
- Ledger: "F&B España, S.A. US/A/Euro".
- Product: Test
- Dates including the documents created.
10 Check in the Trial Balance that:
- Inventory balance is 75EUR (5 units in stock by 15EUR/unit)
- Balance of COGS account is 75EUR
- Balance of Invoice Price Difference account is -50EUR (caused by the return)
11. Create a manual cost adjustment in transaction related to order PO01.
- Amount 200EUR
- Incremental NO
12. Go to product and check:
- Average costs are 20EUR/Unit.
- Transactions costs are changed: Receipts and return 200EUR shipment 100EUR.
13. Ensure that the cost adjustment is Posted
14. Rerun Trial Balance and check:
- Inventory balance is 100EUR (5 units by 20EUR/Unit) -> CORRECT
- Balance of COGS amount is 100EUR (the new total cost of the shipment) -> CORRECT
- Balance of Invoice Price Difference -50EUR. -> WRONG
- Balance of Warehouse Differences -50EUR -> WRONG

We expect to have:
Warehouse Differences 0EUR
Invoice Price difference:
- PO01 should have generated a 100EUR balance as the receipt now is valued at 200EUR and the invoice is for 100EUR.
- Return REceipt should have settled the -50EUR balance as now is valued at 200EUR the same as the invoice.

15. Check the accounting of the Cost Adjustment:
- The adjustment of the PO01 line (100EUR) is done on Warehouse Differences instead of Price Differences
- The adjustment of the return (50EUR) is done on Warehouse Differences instead of Price Differences
- The adjustment of the shipment (25EUR) is done on the COGS account which is correct.
Proposed SolutionIn DocCostAdjustment class -> createFact method -> loop for lines -> if for DocLine_CostAdjustment.TRXTYPE_RECEIPT type.

The account is loaded with following logic:

if (line.getIsSource() && ("PDC").equals(line.getSourceProcess())) {
  // Price Diff Correction
  // Invoice Price Variance CR
  acct = p.getAccount(ProductInfo.ACCTTYPE_P_IPV, as, conn);
} else if (line.getIsSource() && ("LC").equals(line.getSourceProcess())) {
  throw new IllegalStateException(OBMessageUtils.messageBD("LCNotAccounting"));
} else {
  // Product Exp CR
  acct = getAccountByWarehouse(AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn);
}

Only cost adjustments generated by Price Difference Correction process are posted on the Invoice Price Difference account. All other adjustments done to receipts are posted on Warehouse Differences account. The if clause should only check the "isUnitCost" flag. If the adjustment is unit cost the account used should be the Invoice Price Difference account. Independently of the cost adjustment source process. Source lines of Price Difference Process should already be created with the unit cost flag set. So they will still be posted to the same account.

The shipments are always posted on the COGS account but for similar reasons this account should only be used for Unit Cost adjustments. A NO Unit Cost adjustment on a shipment (a very unlikely scenario) should be posted on the Warehouse Differences account.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0115325)
markmm82 (developer)
2019-10-29 14:39

Test Plan:
1. Create a new product Test in F&B España. Purchase Price 20, Sales Price 25.
   Navigate to Accounting tab and set Invoice Price Variance to 99904 - Diferencias entre el coste del producto y el precio de la fra
2. Go to General Ledger Configuration. Select "F&B España, S.A. US/A/Euro" ledger and ensure that in Active Tables the tables related to Receipts, Matched Invoices and Cost Adjustments are active.
3. Create a new Purchase Order (PO01):
- Product Test, Quantity 10units, Price 10EUR
- Create the Receipt and the Invoice.
5. Create a new Purchase Order (PO02):
- Product Test, Quantity 10units, Price 20EUR
- Create the Receipt and the Invoice.
6. Create a Return to Vendor.
- Select the line related to PO02 order and return it completely.
- Set the price to 20EUR
- Create the Return to Vendor Receipt and the negative Purchase Invoice.
7. Create a Sales Order
- Product Test, Quantity 5 units, Price 25EUR.
- Create the Shipment and Invoice.
8. Ensure that the Costing Background process is executed and check that:
- The average cost after PO02 is 15EUR/unit
- The return receipt is valued as 150EUR
- The shipment is valued at 75EUR
9. Run the Trial Balance for:
- Organization: F&B España
- Ledger: "F&B España, S.A. US/A/Euro".
- Product: Test
- Dates including the documents created.
10 Check in the Trial Balance that:
- Inventory balance is 75EUR (5 units in stock by 15EUR/unit)
- Balance of COGS account is 75EUR
- Balance of Invoice Price Difference account is -50EUR (caused by the return)
11. Create a manual cost adjustment in transaction related to order PO01.
- Amount 200EUR
- Incremental NO
12. Go to product and check:
- Average costs are 20EUR/Unit.
- Transactions costs are changed: Receipts and return 200EUR shipment 100EUR.
13. Ensure that the cost adjustment is Posted
14. Rerun Trial Balance and check:
- Inventory balance is 100EUR (5 units by 20EUR/Unit) -> CORRECT
- Balance of COGS amount is 100EUR (the new total cost of the shipment) -> CORRECT
- Balance of Invoice Price Difference -100EUR. -> CORRECT
- Balance of Warehouse Differences is not there -> CORRECT

15. Check the accounting of the Cost Adjustment:
- The adjustment of the PO01 line (100EUR) is done on Price Differences instead of Warehouse Differences which is correct.
- The adjustment of the return (50EUR) is done on Price Differences instead of Warehouse Differences which is correct.
- The adjustment of the shipment (25EUR) is done on the COGS account which is correct.
(0115462)
hgbot (developer)
2019-11-07 18:07

Repository: erp/devel/pi
Changeset: 2e969cbadcaccba94a5e8299ac15e7cb6c8eabec
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Tue Oct 29 21:42:45 2019 -0300
URL: http://code.openbravo.com/erp/devel/pi/rev/2e969cbadcaccba94a5e8299ac15e7cb6c8eabec [^]

Fixes issue 42092: Balanced posting when adjusting a return receipt

When a Goods Receipt Return was adjusted a balance in Warehouse Differences and
Invoice Price Variance account was generated. As only the cost adjustments generated
by Price Difference Correction process are posted on the Invoice Price Difference account
all other adjustments done to receipts are posted on Warehouse Differences account.

The correct behaviour should be: If the adjustment is unit cost the account used should
be the Invoice Price Difference account independently of the cost adjustment source process.

---
M src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment.java
M src/org/openbravo/erpCommon/ad_forms/DocLineCostAdjustment_data.xsql
M src/org/openbravo/erpCommon/ad_forms/DocLine_CostAdjustment.java
---
(0115463)
hgbot (developer)
2019-11-07 18:07

Repository: erp/devel/pi
Changeset: dcd5ec559020306f51f06386a9e559ee4b1e4497
Author: Álvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Nov 07 16:36:01 2019 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/dcd5ec559020306f51f06386a9e559ee4b1e4497 [^]

Related to issue 42092: Code review improvements

---
M src/org/openbravo/erpCommon/ad_forms/DocLineCostAdjustment_data.xsql
M src/org/openbravo/erpCommon/ad_forms/DocLine_CostAdjustment.java
---
(0115464)
hgbot (developer)
2019-11-07 18:07

Repository: erp/devel/pi
Changeset: 20fcab3e0379c9e86d0ea3a4840b514a19f47426
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Wed Oct 30 22:02:25 2019 -0300
URL: http://code.openbravo.com/erp/devel/pi/rev/20fcab3e0379c9e86d0ea3a4840b514a19f47426 [^]

Related to issue 42092: Fixed costing tests

---
M src-test/src/org/openbravo/test/costing/TestCostingLandedCost.java
M src-test/src/org/openbravo/test/costing/TestCostingNoSourceAdjustments.java
M src-test/src/org/openbravo/test/costing/TestCostingSourceAdjustments.java
---
(0115465)
aferraz (manager)
2019-11-07 18:08

Code review + Testing OK
(0116275)
hudsonbot (developer)
2019-12-12 23:01

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/954d2b7a66fb [^]
Maturity status: Test
(0116276)
hudsonbot (developer)
2019-12-12 23:01

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/954d2b7a66fb [^]
Maturity status: Test
(0116277)
hudsonbot (developer)
2019-12-12 23:01

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/954d2b7a66fb [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2019-10-22 14:29 gorkaion New Issue
2019-10-22 14:29 gorkaion Assigned To => Triage Finance
2019-10-22 14:29 gorkaion Modules => Core
2019-10-22 14:29 gorkaion Resolution time => 1573513200
2019-10-22 14:29 gorkaion Triggers an Emergency Pack => No
2019-10-22 16:19 Sandrahuguet Assigned To Triage Finance => markmm82
2019-10-24 23:17 markmm82 Status new => scheduled
2019-10-29 10:46 Sandrahuguet Steps to Reproduce Updated View Revisions
2019-10-29 14:39 markmm82 Note Added: 0115325
2019-11-07 18:07 hgbot Checkin
2019-11-07 18:07 hgbot Note Added: 0115462
2019-11-07 18:07 hgbot Status scheduled => resolved
2019-11-07 18:07 hgbot Resolution open => fixed
2019-11-07 18:07 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2e969cbadcaccba94a5e8299ac15e7cb6c8eabec [^]
2019-11-07 18:07 hgbot Checkin
2019-11-07 18:07 hgbot Note Added: 0115463
2019-11-07 18:07 hgbot Checkin
2019-11-07 18:07 hgbot Note Added: 0115464
2019-11-07 18:08 aferraz Review Assigned To => aferraz
2019-11-07 18:08 aferraz Note Added: 0115465
2019-11-07 18:08 aferraz Status resolved => closed
2019-11-07 18:08 aferraz Fixed in Version => 3.0PR20Q1
2019-12-12 23:01 hudsonbot Checkin
2019-12-12 23:01 hudsonbot Note Added: 0116275
2019-12-12 23:01 hudsonbot Checkin
2019-12-12 23:01 hudsonbot Note Added: 0116276
2019-12-12 23:01 hudsonbot Checkin
2019-12-12 23:01 hudsonbot Note Added: 0116277


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker