Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0042092 | Openbravo ERP | 04. Warehouse management | public | 2019-10-22 14:29 | 2019-12-12 23:01 |
Reporter | gorkaion | ||||
Assigned To | markmm82 | ||||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | 3.0PR20Q1 | |||
Merge Request Status | |||||
Review Assigned To | aferraz | ||||
OBNetwork customer | OBPS | ||||
Web browser | |||||
Modules | Core | ||||
Support ticket | 12034 | ||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0042092: Unbalance posting when adjusting a return receipt | ||||
Description | When 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 Reproduce | 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 -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 Solution | In 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. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
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 | OBNetwork customer | => OBPS | ||
2019-10-22 14:29 | gorkaion | Modules | => Core | ||
2019-10-22 14:29 | gorkaion | Support ticket | => 12034 | ||
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 | bug_revision_view_page.php?rev_id=19574#r19574 | ||
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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|