Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034802Openbravo ERP04. Warehouse managementpublic2016-12-21 17:212017-03-15 20:18
maite 
rqueralta 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q2 
markmm82
Core
No
0034802: Unhomogeneous behavior in Cost Adjustments: price difference/backdated/negative stock adjustments are created for generic orgs
Costs are calculated at "Legal" organization level so Cost Adjustments should be created at "Legal" organization level also because to adjust an specific "generic" organization transaction can implies to adjust another "generic" organization transaction (both belonging to same "legal"). So "Cost Adjustment" document should always be created for "legal" organization and each line will belong to specific "generic" organization
1. Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
2. Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner. Add line for previous product and qty=10. Process
3. Register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner. Run "create lines from" process, select previous order and process
4. Run Costing Background process and verify that cost for this transaction is calculated to 50
5. Register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner. Add line for previous product and qty=2. Process shipment
6. Run Costing Background process and verify that cost is calculated to 10
7. Register Purchase Invoice for "España norte" organization and "Bebidas alegres" business partner. Run "create lines from" process, select previous receipt. Edit invoice line to set price=7 and complete
8. Run "Process Price Difference Adjustment" process for "España norte" organization, today's date and previous product
9. Access Cost Adjustment window and verify that record has been created for "España norte" organization instead of "España" organization
Cost Adjustment document should be as follows:
  * "Legal" organization should be set in the header
  * Organization field should be shown in Cost Adjustment Lines. And it should be set with transaction's organization ("generic" in previous example)

When posting Cost Adjustment document, line's organization should be considered so previous line will post to "generic" organization
No tags attached.
causes defect 0035015 closed collazoandy4 Organization's natural tree error in cost adjustment line's structure 
Issue History
2016-12-21 17:21maiteNew Issue
2016-12-21 17:21maiteAssigned To => Triage Finance
2016-12-21 17:21maiteModules => Core
2016-12-21 17:21maiteTriggers an Emergency Pack => No
2016-12-21 17:31maiteProposed Solution updated
2016-12-21 17:32maiteResolution time => 1483484400
2016-12-21 17:32maiteIssue Monitored: networkb
2016-12-21 20:57markmm82Assigned ToTriage Finance => rqueralta
2016-12-23 14:14rqueraltaNote Added: 0092975
2016-12-23 20:55rqueraltaStatusnew => scheduled
2016-12-26 21:26rqueraltaNote Added: 0093000
2017-01-02 12:08psanjuanNote Added: 0093087
2017-01-02 13:16psanjuanNote Added: 0093100
2017-01-02 13:26psanjuanNote Edited: 0092975bug_revision_view_page.php?bugnote_id=0092975#r14144
2017-01-02 13:28psanjuanNote Added: 0093105
2017-01-02 13:38psanjuanNote Edited: 0093105bug_revision_view_page.php?bugnote_id=0093105#r14146
2017-01-02 13:41psanjuanNote Added: 0093108
2017-01-02 13:44psanjuanNote Edited: 0093108bug_revision_view_page.php?bugnote_id=0093108#r14148
2017-01-02 13:48psanjuanNote Edited: 0093108bug_revision_view_page.php?bugnote_id=0093108#r14149
2017-01-02 14:03psanjuanNote Added: 0093109
2017-01-02 14:14psanjuanNote Edited: 0093109bug_revision_view_page.php?bugnote_id=0093109#r14151
2017-01-02 14:19psanjuanNote Edited: 0093109bug_revision_view_page.php?bugnote_id=0093109#r14152
2017-01-02 14:26psanjuanNote Added: 0093110
2017-01-02 14:33psanjuanNote Edited: 0093110bug_revision_view_page.php?bugnote_id=0093110#r14154
2017-01-02 14:35psanjuanNote Added: 0093111
2017-01-02 14:37psanjuanNote Added: 0093112
2017-01-02 14:44psanjuanNote Edited: 0093111bug_revision_view_page.php?bugnote_id=0093111#r14156
2017-01-02 14:53psanjuanNote Edited: 0093111bug_revision_view_page.php?bugnote_id=0093111#r14157
2017-01-02 14:54psanjuanNote Edited: 0093111bug_revision_view_page.php?bugnote_id=0093111#r14158
2017-01-02 14:55psanjuanNote Edited: 0093111bug_revision_view_page.php?bugnote_id=0093111#r14159
2017-01-02 14:57psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14161
2017-01-02 14:58psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14162
2017-01-02 14:58psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14163
2017-01-02 15:03psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14164
2017-01-02 15:07psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14165
2017-01-02 15:09psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14166
2017-01-02 15:12psanjuanNote Edited: 0093112bug_revision_view_page.php?bugnote_id=0093112#r14167
2017-01-02 15:13psanjuanNote Added: 0093113
2017-01-04 15:17hgbotCheckin
2017-01-04 15:17hgbotNote Added: 0093184
2017-01-04 15:17hgbotStatusscheduled => resolved
2017-01-04 15:17hgbotResolutionopen => fixed
2017-01-04 15:17hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e55d9bf9a2b7fad6c133630ded4c4c4ca8074909 [^]
2017-01-04 15:21markmm82Review Assigned To => markmm82
2017-01-04 15:21markmm82Note Added: 0093185
2017-01-04 15:21markmm82Statusresolved => closed
2017-01-04 15:21markmm82Fixed in Version => 3.0PR17Q1
2017-01-09 20:17markmm82Fixed in Version3.0PR17Q1 => 3.0PR17Q2
2017-01-19 18:28maiteRelationship addedcauses 0035015
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095062

Notes
(0092975)
rqueralta   
2016-12-23 14:14   
(edited on: 2017-01-02 13:26)
Test plan:

As F&B International Group Admin

  - Go to Product window
    Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
  - Go to Purchase Order window
    Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner.
    Add line for previous product and qty=10. Process it
  - Go to Goods Receipt window
    Register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner.
    Run "create lines from" process, select previous order and process it
  - Go to Process Request window
    Run Costing Background process and verify that cost for this transaction is calculated to 50
  - Go to Goods Shipment
    Register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner.
    Add line for previous product and qty=2. Process shipment
  - Go to Process Request window
    Run Costing Background process and verify that cost is calculated to 10
  - Go to Purchase Invoice window
    Register Purchase Invoice for "España norte" organization and "Bebidas alegres" business partner.
    Run "create lines from" process, select previous receipt.
    Edit invoice line to set price=7 and complete
  - Run "Process Price Difference Adjustment" process for "España norte" organization, today's date and previous product
  - Go to Cost Adjustment window
    Verify that record has been created for "F&B España, S.A" organization
    Verify in Lines tab that record has been created for "F&B España - Región Norte" organization

(0093000)
rqueralta   
2016-12-26 21:26   
Script to fix erroneous data:

UPDATE m_costadjustment set ad_org_id = (select ad_get_org_le_bu(ad_org_id,'LE'))
(0093087)
psanjuan   
2017-01-02 12:08   
Verify also:
LandedCost, FixBackdated, ManualCostAdjustment, LCMatching y CostingServer,
(0093100)
psanjuan   
2017-01-02 13:16   
Issue verified.
(0093105)
psanjuan   
2017-01-02 13:28   
(edited on: 2017-01-02 13:38)
Test Case 1 - Process Price Difference Adjustment process

As F&B International Group Admin

- Go to Product window
- Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
- Go to Purchase Order window
- Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner.
- Add line for previous product and qty=10. Process it
- Go to Goods Receipt window and register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous order and process it
- Go to Process Request window
- Run Costing Background process and verify that cost for this transaction is calculated to 50.00
- Go to Goods Shipment and register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner.
- Add line for previous product and qty=2. Process shipment
- Go to Process Request window
- Run Costing Background process and verify that cost is calculated to 10
- Go to Purchase Invoice window and register Purchase Invoice for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous receipt.
- Edit invoice line to set price=7 and complete
- Run "Process Price Difference Adjustment" process for "España norte" organization, today's date and previous product
- Go to Cost Adjustment window
- Verify that cost adjustment has been created for "F&B España, S.A" organization
- Verify in Lines tab that two records have been created for "F&B España - Región Norte" organization:
* Source one V+ for an adjutsment amount = 20.00 (70-50)
* No Source one C- for an adjustment amount = 4.00 (14-10)
- Post cost adjustment.
- Verify cost adjustment transaction is post to both F&B España Euro and F&B International Group US general ledger configurations.

(0093108)
psanjuan   
2017-01-02 13:41   
(edited on: 2017-01-02 13:48)
Test Case 2 - Price Correction Background process (created at F&B International Group level).

As F&B International Group Admin

- Go to Process Request window and create a new record with below setup:
Client = F&B International Group
Organization = *
Timing = Run inmediatly
Process = Price Correction Background.
- Go to Product window
- Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
- Go to Purchase Order window
- Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner.
- Add line for previous product and qty=10. Process it
- Go to Goods Receipt window and register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous order and process it
- Go to Process Request window
- Run Costing Background process and verify that cost for this transaction is calculated to 50.00
- Go to Goods Shipment and register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner.
- Add line for previous product and qty=2. Process shipment
- Go to Process Request window
- Run Costing Background process and verify that cost is calculated to 10
- Go to Purchase Invoice window and register Purchase Invoice for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous receipt.
- Edit invoice line to set price=7 and complete
- Go to process request window and run price correction process.
- Go to Cost Adjustment window
- Verify that cost adjustment has been created for "F&B España, S.A" organization
- Verify in Lines tab that two records have been created for "F&B España - Región Norte" organization:
* Source one V+ for an adjutsment amount = 20.00 (70-50)
* No Source one C- for an adjustment amount = 4.00 (14-10)
- Post cost adjustment.
- Verify cost adjustment transaction is post to both F&B España Euro and F&B International Group US general ledger configurations.

Repeat same test as above (test case 2) but setup of price correction background process at F&B España level.

(0093109)
psanjuan   
2017-01-02 14:03   
(edited on: 2017-01-02 14:19)
Test Case 3 - Landed Cost

As F&B International Group Admin

- Go to G/L Item account and create a new one with below setup:
Organization: F&B España
Name : shipping cost
In Accounting tab select the account 62400 for F&B España general ledger and account 5850 for F&B International Group general ledger.

- Go to Landed Cost Type window and create a new one with below setup:
Organization: F&B España
Name : shipping cost
Account : Shipping cost (G/L Item)
Landed Cost Distribution Algorithm: Distribution by Amount.

- Go to Product window
- Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
- Go to Purchase Order window
- Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner.
- Add line for previous product and qty=10. Process it
- Go to Goods Receipt window and register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous order and process it
- Go to Process Request window
- Run Costing Background process and verify that cost for this transaction is calculated to 50.00
- Go to Goods Shipment and register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner.
- Add line for previous product and qty=2. Process shipment
- Go to Process Request window
- Run Costing Background process and verify that cost is calculated to 10

- Go to Purchase Invoice window and register Purchase Invoice for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous receipt. Complete the invoice.

- Go to landed cost window and create a new one for "F&B España - Region Norte" with below data:
Cost tab: Landed Cost Type = Shipping Cost
Amount = 30
Receipt tab = select the goods receipt just created.
- Process landed cost
- Go to Cost Adjustment window
- Verify that a cost adjustment has been created for "F&B España, S.A" organization
- Verify in Lines tab that two records have been created for "F&B España - Región Norte" organization:
* Source one V+ for an adjutsment amount = 30.00
* No Source one C- for an adjustment amount = 6.00 (3*2)

- Go to product window and verify that average cost has changed from 5 to 8 (50+30/10)
- Go to transaction tab and verify that vendor receipt has changed from 50 to 80 and customer shipment from 10 to 16

(0093110)
psanjuan   
2017-01-02 14:26   
(edited on: 2017-01-02 14:33)
Test Case 4 - Manual Cost Adjustment.

As F&B International Group Admin

- Go to Product window
- Create new Product for "España" organization. Define Price for "Bebidas Alegres"= 5 and "Tarifa de ventas"= 7
- Go to Purchase Order window
- Register Purchase Order for "España norte" organization and "Bebidas alegres" business partner.
- Add line for previous product and qty=10. Process it
- Go to Goods Receipt window and register Goods Receipt for "España norte" organization and "Bebidas alegres" business partner.
- Run "create lines from" process, select previous order and process it
- Go to Process Request window
- Run Costing Background process and verify that cost for this transaction is calculated to 50.00
- Go to Goods Shipment and register Goods Shipment for "España norte" organization and "Alimentos y Supermercados" business partner.
- Add line for previous product and qty=2. Process shipment
- Go to Process Request window
- Run Costing Background process and verify that cost is calculated to 10
- In Transaction tab, select vendor receipt transaction and click on "Manual Cost Adjustment" process button, enter below information:
- Total Cost Amount = 80.00, Accounting date = today's date. Press Done.
- Verify that new cost is now 8 and transaction cost has changed to 80 (vendor receipt) and 16 (customer shipment).

- Go to Cost Adjustment window
- Verify that a cost adjustment has been created for "F&B España, S.A" organization, source process = Manual Cost Correction.
- Verify in Lines tab that two records have been created for "F&B España - Región Norte" organization:
* Source one V+ for an adjutsment amount = 30.00
* No Source one C- for an adjustment amount = 6.00 (2*3.00)
- Post cost adjustment.
- Verify cost adjustment transaction is post to both F&B España Euro and F&B International Group US general ledger configurations.

(0093111)
psanjuan   
2017-01-02 14:35   
(edited on: 2017-01-02 14:55)
Test Case 5 - Fix backdated transaction.

- Go to Costing Rule window and select F&B España one.
- Click on "Fix Backdated Transactions" process button.
- Enter Fix Backdated From date = 01-01-2016. Press Done.

- Go to product window and create a new product for F&B España. Go to price tab and enter a unit/list price = 5 for Tarifa Bebidas Alegres and a unit/list price = 7 for Tarifa Ventas.

- Go to purchase order and create a new one for F&B España - Region Norte, dated on today's date = 02-01-2017
- In lines tab select the product, enter 10 units. Book the order.
- Go to Goods Receipt window and create a new one for F&B España - Region Norte, dated on todays' date = 02-01-2017. Select the order and complete the receipt.
- Run Costing Background and verify that the cost of the product is 5 and vendor transaction value is 50.00

- Go to Goods shipment window and create a new one for F&B España - Region Norte, Alimentos y Supermercados business partner, dated on today's date 02-01-2017
- In lines tab select the product. Enter a movement quantity = 2. Complete the shipment.
- Run Costing Background and verify that the cost of the product remains as 5 and customer transaction value is 10.00

- Go to purchase order and create a new one for F&B España - Region Norte, dated on 01-01-2017
- In lines tab select the product, enter 10 units. Change purchase price to 2.00. Book the order.
- Go to Goods Receipt window and create a new one for F&B España - Region Norte, dated on 01-01-2017. Select the order and complete the receipt.
- Run Costing Background

- Go to product window and verify that the cost of the product has been split into two lines first one for a cost =2 and second one for a cost = 3.5 (50+20/20)
- Go to transaction tab and verify that customer shipment transaction has been adjusted from 10 (2*5) to 7 (2*3.5)

- Go to Cost Adjustment window and verify that a new one has been created caused by source process "Backdated Transaction".
- Verify that it has been created for F&B España, while adjustemnt lines are created for F&B España - Región Norte organization.

- Post adjustment and verify it is posted for both F&B España and F&B International group general ledger configuration.

(0093112)
psanjuan   
2017-01-02 14:37   
(edited on: 2017-01-02 15:12)
Test Case 6 - Negative Stock Correction

- Go to Client window and "Allow Negative Stock" for F&B International Group Client.
- Go to Preference window and create a new one with below setup:
Organization = F&B España
Property = Enable Negative Stock Corrections
Value = Y
Visible at user = Openbravo.
- Log out and Log in.

- Go to product window and create a new product for F&B España. Go to price tab and enter a unit/list price = 5 for Tarifa Bebidas Alegres and a unit/list price = 7 for Tarifa Ventas.

- Go to purchase order and create a new one for F&B España - Region Norte, dated on today's date = 02-01-2017
- In lines tab select the product, enter 10 units. Book the order.
- Go to Goods Receipt window and create a new one for F&B España - Region Norte, dated on todays' date = 02-01-2017. Select the order and complete the receipt.
- Run Costing Background and verify that the cost of the product is 5 and vendor transaction value is 50.00

- Go to Goods shipment window and create a new one for F&B España - Region Norte, Alimentos y Supermercados business partner, dated on today's date 02-01-2017
- In lines tab select the product. Enter a movement quantity = 10. Complete the shipment.
- Run Costing Background and verify that the cost of the product remains as 5 and customer transaction value is 50.00

- Go to Goods shipment window and create a new one for F&B España - Region Norte, Alimentos y Supermercados business partner, dated on today's date 02-01-2017
- In lines tab select the product. Enter a movement quantity = 5, and select an storage bin. Complete the shipment.
- Run Costing Background and verify that the cost of the product remains as 5 and customer transaction value is 25.00

- Go to purchase order and create a new one for F&B España - Region Norte, dated on today's date = 03-01-2017
- In lines tab select the product, enter 10 units. Change price to 6. Book the order.
- Go to Goods Receipt window and create a new one for F&B España - Region Norte, dated on todays' date = 03-01-2017. Select the order and complete the receipt.

- Run Costing Backgroun process.

- Go to product window and verify that there is a new cost = 6.

- Go to Cost adjustment window and verify that a new one has been created for F&B España, Source Process = Negative stock correction, with a line for the second vendor receipt, and an amount = -5.00.

(0093113)
psanjuan   
2017-01-02 15:13   
Test plan above verified.
Issue can be code reviewed and closed.
(0093184)
hgbot   
2017-01-04 15:17   
Repository: erp/devel/pi
Changeset: e55d9bf9a2b7fad6c133630ded4c4c4ca8074909
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Fri Dec 23 10:39:36 2016 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/e55d9bf9a2b7fad6c133630ded4c4c4ca8074909 [^]

Fixes issue 34802: Unhomogeneous behavior in Cost Adjustments

 Now when Cost Adjustment is created:
 - In header, Organization field is filled with the "Legal" organization of the
   transaction's organization
 - Organization field is shown in Cost Adjustment Lines and filled with
   transaction's organization

---
M src-db/database/sourcedata/AD_FIELD.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
---
(0093185)
markmm82   
2017-01-04 15:21   
Code review + Testing OK
(0095062)
hudsonbot   
2017-03-15 20:18   
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