Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037302Openbravo ERP09. Financial managementpublic2017-11-16 09:412018-01-03 12:39
dmiguelez 
nonofrancisco 
urgentmajoralways
closedfixed 
5
 
3.0PR18Q1 
dmiguelez
Core
No
0037302: Process Price Difference Correction fails with n.p.e. or create wrong Cost Adjustment Documents when it works
Process Price Difference Correction has two related problems:
* It throws an n.p.e. error when launched for * Organization
* It can create wrong Cost Adjustment Documents if launched for any other Organization (it mixes transactions from different legal entities in the same document)
Steps to reproduce


1. Create a Purchase Order - Goods Receipt - Purchase Invoice for España

  1.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Ale
      * Ordered Quantity: 1
    Book the Purchase Order

  1.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  1.3. Schedule Costing Background Process
    Go to Process Request Window and create a new record with:
      * Organization: *
      * Process: Costing Background Process
    Schedule the process

  1.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice


2. Create a Purchase Order - Goods Receipt - Purchase Invoice for US
  2.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Move to lines and create a new record with:
      * Product: Cherry Cola
      * Ordered Quantity: 1
    Book the Purchase Order

  2.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  2.3. Schedule Costing Background Process
    Go to Process Request Window and reschedule the previously created Costing Background Process entry

  2.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice


3. Check Process Price Difference Errors

  3.1. Check n.p.e. error
    Go to Process Price Difference Adjustment Window and set:
      * Organization: *
      * Movement Date: 1 month previous to Today

    An error is thrown (due to a null pointer exception)

  3.2. Check document's Organizations errors
    Reload the Window and set:
      * Organization: US
      * Movement Date: 1 month previous to Today

    Move to Cost Adjustment window and check that there is a new record created.
    This record has Organization España, however, it has transactions for both España and US.

  This process should create records in the Cost Adjustmen Window per legal entity.
If launched for US or it's children Organizations, one record for US that contains only transactions from US or it's children Organizations
If lauched for * it should create records for España and US, each one with their transactions
No tags attached.
related to defect 0037412 closed dmiguelez API Change request 
Issue History
2017-11-16 09:41dmiguelezNew Issue
2017-11-16 09:41dmiguelezAssigned To => Triage Finance
2017-11-16 09:41dmiguelezModules => Core
2017-11-16 09:41dmiguelezTriggers an Emergency Pack => No
2017-11-16 09:43dmiguelezAssigned ToTriage Finance => nonofrancisco
2017-11-16 10:11maiteResolution time => 1512342000
2017-11-16 11:48dmiguelezStatusnew => scheduled
2017-11-17 14:37nonofranciscoNote Added: 0100589
2017-11-30 09:12hgbotCheckin
2017-11-30 09:12hgbotNote Added: 0100820
2017-11-30 09:12hgbotStatusscheduled => resolved
2017-11-30 09:12hgbotResolutionopen => fixed
2017-11-30 09:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7ce264deda382f46c21f0fb12937ece94d1f9d0e [^]
2017-11-30 09:12hgbotCheckin
2017-11-30 09:12hgbotNote Added: 0100821
2017-11-30 09:13hgbotCheckin
2017-11-30 09:13hgbotNote Added: 0100822
2017-11-30 09:21dmiguelezReview Assigned To => dmiguelez
2017-11-30 09:21dmiguelezNote Added: 0100825
2017-11-30 09:21dmiguelezStatusresolved => closed
2017-11-30 09:21dmiguelezFixed in Version => 3.0PR18Q1
2017-12-29 09:47ngarciaRelationship addedrelated to 0037412
2017-12-29 13:46hgbotCheckin
2017-12-29 13:46hgbotNote Added: 0101289
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101500
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101501

Notes
(0100589)
nonofrancisco   
2017-11-17 14:37   
Test Plan #1. Price Difference Adjustment for organization "*"

1. Create a Purchase Order - Goods Receipt - Purchase Invoice for España

  1.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Ale
      * Ordered Quantity: 1
    Book the Purchase Order

  1.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  1.3. Schedule Costing Background Process
    Go to Process Request Window and create a new record with:
      * Organization: *
      * Process: Costing Background Process
    Schedule the process

  1.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: España
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice


2. Create a Purchase Order - Goods Receipt - Purchase Invoice for US
  2.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Move to lines and create a new record with:
      * Product: Cherry Cola
      * Ordered Quantity: 1
    Book the Purchase Order

  2.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  2.3. Schedule Costing Background Process
    Go to Process Request Window and reschedule the previously created Costing Background Process entry

  2.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: US
      * Business Partner: Be Soft Drinker
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice

3. Process Price Difference Adjustment
  3.1 Go to Process Price Difference Adjustment
    * Organization: *
    * Date: Today
    Run the process
    Verify a success message is shown indicating 2 transactions have been adjusted
  3.2 Go to Cost Adjustment window
    Verify two new records have been created:
     * With F&B España SA as organization in the header and a line for "Cerveza Ale" Goods Receipt transaction
     * With F&B US Inc as organization in header and a line for "Cherry Cola" Goods Receipt transaction

Test Plan #2. Price Difference Adjustment for non legal organization

1. Create a Purchase Order - Goods Receipt - Purchase Invoice for España - Region Norte

  1.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Ale
      * Ordered Quantity: 1
    Book the Purchase Order

  1.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  1.3. Schedule Costing Background Process
    Go to Process Request Window and reschedule the previously created Costing Background Process entry

  1.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice

2. Create a Purchase Order - Goods Receipt - Purchase Invoice for España - Region Sur

  2.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Lager
      * Ordered Quantity: 1
    Book the Purchase Order

  2.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  2.3. Schedule Costing Background Process
    Go to Process Request Window and reschedule the previously created Costing Background Process entry

  2.4. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice

3. Process Price Difference Adjustment
  3.1 Go to Process Price Difference Adjustment
    * Organization: F&B España - Region Norte
    * Date: Today
    Run the process
    Verify a success message is shown indicating 2 transactions have been adjusted
  3.2 Go to Cost Adjustment window
    Verify a new record have been created with F&B España SA as organization in the header and two lines:
     * With "Cerveza Ale" Goods Receipt transaction
     * With "Cerveza Lager" Goods Receipt transaction

Test Plan #3. Price Difference Adjustment from Costing Background Process

1. Create a Purchase Order - Goods Receipt - Purchase Invoice for España - Region Norte

  1.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Ale
      * Ordered Quantity: 1
    Book the Purchase Order

  1.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  1.3. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: F&B España - Region Norte
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice

2. Create a Purchase Order - Goods Receipt - Purchase Invoice for España - Region Sur

  2.1. Create a Purchase Order
    Go to Purchase Order Window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Move to lines and create a new record with:
      * Product: Cerveza Lager
      * Ordered Quantity: 1
    Book the Purchase Order

  2.2. Create a related Goods Receipt
    Go to Goods Receipt window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Purchase Order
    Complete the Goods Receipt

  2.3. Create a related Purchase Invoice with different price
    Go to Purchase Invoice Window and create a new record with:
      * Organization: F&B España - Region Sur
      * Business Partner: Bebidas Alegres
    Click on Create Lines From button and select the previously created Goods Receipt
    Select the created line and change its Net Unit Price to 10.00
    Complete the Purchase Invoice

3. Process Price Difference Adjustment
  3.1 Set "Enable automatic Price Difference Corrections" preference for organization "*"
  3.2 Schedule Costing Background Process
  3.2 Go to Cost Adjustment window
    Verify two new records have been created:
     * With F&B España SA as organization in the header and a line for "Cerveza Ale" Goods Receipt transaction
     * With F&B España SA as organization in header and a line for "Cerveza Lager" Goods Receipt transaction
(0100820)
hgbot   
2017-11-30 09:12   
Repository: erp/devel/pi
Changeset: 7ce264deda382f46c21f0fb12937ece94d1f9d0e
Author: Nono Carballo <nonofce <at> gmail.com>
Date: Tue Nov 28 18:05:00 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/7ce264deda382f46c21f0fb12937ece94d1f9d0e [^]

Fixes issue 37302: Process Price Difference Correction fails with n.p.e. or
create wrong Cost Adjustment Documents when it works

Price Difference Adjustment process is invoked for legal organizations.

When invoked from manual process, the legal organization(s) of selected
organization is retrieved, the process is invoked for that legal organization
in order to the Cost Adjustment Document be created with the legal organization
in the header, and lines for transaction belonging to organizations under it.

When invoked from the background process, the process is invoked for legal
organizations under organization "*".

When invoked from the Costing Background process, the legal organization of the
transaction organization is retrieved, and is used to invoke the process.

---
M src/org/openbravo/costing/PriceDifferenceBackground.java
M src/org/openbravo/costing/PriceDifferenceByDateProcess.java
M src/org/openbravo/costing/PriceDifferenceProcess.java
A src/org/openbravo/costing/PriceDifferenceUtil.java
---
(0100821)
hgbot   
2017-11-30 09:12   
Repository: erp/devel/pi
Changeset: 741f87599303c833f26ba72385a1f2919bb73d87
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Tue Nov 28 18:28:16 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/741f87599303c833f26ba72385a1f2919bb73d87 [^]

Related to Issue 37302. Code Review Changes. Improved Java Doc

---
M src/org/openbravo/costing/PriceDifferenceProcess.java
---
(0100822)
hgbot   
2017-11-30 09:13   
Repository: erp/devel/api-checks
Changeset: 69cf83fbda54917a194fb013afb44ab4db100d81
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Nov 30 09:12:29 2017 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/69cf83fbda54917a194fb013afb44ab4db100d81 [^]

Fixes Issue 37412. API Change due to fixing Issue 37302

---
M java/reference/java.japi.gz
---
(0100825)
dmiguelez   
2017-11-30 09:21   
Code Review + Testing Ok
(0101289)
hgbot   
2017-12-29 13:46   
Repository: erp/devel/api-checks
Changeset: d9d9285d3022fbec70f87812cde98e507a50c063
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Nov 30 09:12:29 2017 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/d9d9285d3022fbec70f87812cde98e507a50c063 [^]

Fixes Issue 37412. API Change due to fixing Issue 37302

---
M java/reference/java.japi.gz
---
(0101500)
hudsonbot   
2018-01-03 12:39   
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/c81e0d3cbab5 [^]
Maturity status: Test
(0101501)
hudsonbot   
2018-01-03 12:39   
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/c81e0d3cbab5 [^]
Maturity status: Test