Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0005564Openbravo ERP01. General setuppublic2008-10-17 12:592009-03-05 09:21
rafaroda 
rafaroda 
normalmajoralways
closedfixed 
20Ubuntu 7.10
pi 
 
Core
No
0005564: Multi currency issues in some processes and tables
There are multi currency issues in the following processes and tables:
   1. AD_CLIENT:
         1. PROBLEM: client does not have a "base" currency. This "base" currency is taken in some cases from the accounting schema of the client. This will not be valid anymore since one Client could have more than one accounting schema.
         2. SOLUTION: define a base currency for a client.
         3. IMPLEMENTATION: AD_CLIENT table [3] should have a mandatory Client_Currency column. 'Initial Client Setup' should fill this column (maybe based of the currency of the Chart of Accounts?). For existing clients, there should be a script that fills this column (maybe based on client's primary accounting schema currency?). This Base Currency should not be updateable, even if a client changes its accounting schemas.
   2. M_COSTING:
         1. PROBLEM: M_COSTING table [4] has two columns (Price and Cost) that do not have a corresponding currency. Three processes update these values without taking into account any currency: M_GENERATE_AVERAGE_COSTS [5], M_GENERATE_STANDARD_COSTS [6] and MA_PRODUCTION_COST [7].
         2. SOLUTION: assume that Price and Cost values are in the Base Currency of the Client.
         3. IMPLEMENTATION: Re-code M_GENERATE_AVERAGE_COSTS, M_GENERATE_STANDARD_COSTS and MA_PRODUCTION_COST processes in order that they do a conversion into the Client base currency before inserting/updating values into Price and Cost columns of M_COSTING. Additionally, for M_GENERATE_AVERAGE_COSTS process, make the corresponding conversions from invoices, orders or shipments currencies to client's base currency.
   3. MA_SEQUENCEPRODUCT:
         1. PROBLEM: MA_SEQUENCEPRODUCT table [8] (Production Management || Transactions || Process Plan || Process Plan >> Version >> Operation >> I/O Products ) has a COST column that has not an associated currency. MA_STANDARD_COST_SEQUENCE process [9] updates this value.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to MA_STANDARD_COST_SEQUENCE process in order to make conversions into the Client base currency.
   4. MA_COSTCENTER:
         1. PROBLEM: MA_COSTCENTER table [10] has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
   5. MA_COSTCENTER_VERSION:
         1. PROBLEM: MA_COSTCENTER_VERSION table [11] (Production Management || Setup || Cost Center || Cost Center >> Version) has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
   6. MA_INDIRECT_COST_VALUE:
         1. PROBLEM: MA_INDIRECT_COST_VALUE table [12] has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
   7. MA_MACHINE_COST:
         1. PROBLEM: MA_MACHINE_COST table [13] has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
   8. MA_PL_INVOICELINE:
         1. PROBLEM: MA_PL_INVOICELINE table [14] has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
   9. C_SALARY_CATEGORY_COST:
         1. PROBLEM: C_SALARY_CATEGORY_COST table [15] has a COST column that has not an associated currency. Find out which processes update/insert values in COST.
         2. SOLUTION: assume that Cost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
  10. M_PRODUCTIONLINE:
         1. PROBLEM: M_PRODUCTIONLINE table [16] has a CALCCOST column that has not an associated currency. Find out which processes update/insert values in CALCCOST.
         2. SOLUTION: assume that CalcCost values are in the base currency of the client.
         3. IMPLEMENTATION: make, if necessary, the corresponding changes to the processes that insert/update values in order to make conversions to Client base currency.
  11. M_INOUT:
         1. PROBLEM: M_INOUT table [17] (Procurement Management || Transactions || Goods Receipt || Header) has a FREIGHTAMT column that has not an associated currency. This column can be set via a process or calculated based on the values inside Warehouse Management || Setup || Shipping Company || Shipping Company >> Freight.
         2. SOLUTION: add a new non-mandatory column FREIGHT_CURRENCY to M_INOUT in order to indicate the currency of the freight amount.
         3. IMPLEMENTATION: if the freight amount is set manually one could select the currency. If it is calculated via the process, it should update the currency field.
  12. M_OFFER:
         1. PROBLEM: M_OFFER table [18] (Master Data Management || Pricing || Price Adjustments || Adjustments ) has ADDAMT and FIXED columns that have not an associated currency. These columns are used for making fixed price adjustments. The problem is that, taking a fixed discount of 50, if one customer A has a price list in EUR and a product's price is 250 €, he will get it for 150 €. If for the same product, a customer B has a price list in pesos and product's price is 10.000 Pesos, he will get it for 9.950 Pesos.
         2. SOLUTION: assume that the user setting up price adjustments is smart enough to take care of these things and registers different price adjustments for different price lists (specially if they have different currencies). Second solution will require to add a currency column to M_OFFER table to indicate the currency in which this price adjustment is done.
         3. IMPLEMENTATION: the second solution would require to review the processes that calculate the price adjustments and make the conversions between price list currency and price adjustment currency.
  13. Default currency for an user:
         1. PROBLEM: when a user accesses a multi currency report, he wants its "defect" currency to be selected by default in the currency window. Which is this "defect" currency?
         2. SOLUTION: take the base currency of the Client as the "defect" curerncy of the user?

There are other tables with a COST column:

    * M_PRODUCT -> COSTSTD
    * C_BPARTNER -> SO_CREDITLIMIT SO_CREDITUSED ACQUSITIONCOST
    * C_CAMPAIGN -> COSTS
    * I_PRODUCT -> COSTPERORDER
    * M_PRODUCT_PO -> COSTPERORDER --> HAS CURRENCY
    * C_PROJECT -> SERVCOST --> HAS CURRENCY
    * M_PRODUCTIONLINE -> CALCCOST COMPONENTCOST
    * MA_PRODUCTIONPLAN -> CALCCOST
    * MA_PL_EMPLOYEE -> CALCCOST
    * MA_PL_IC -> CALCCOST
    * MA_PL_MACHINE -> CALCCOST
    * MA_SEQUENCE_EMPLOYEE -> CALCCOST
    * MA_SEQUENCE_IC -> CALCCOST
    * MA_SEQUENCE_MACHINE -> CALCCOST
    * MA_SEQUENCE -> COSTCENTERCOST
    * MA_WRPHASEPRODUCT -> COMPONENTCOST
    * R_RESOURCEPLANCOST -> PLANCOST

[3] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/AD_CLIENT.xml [^]
[4] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/M_COSTING.xml [^]
[5] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml [^]
[6] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/functions/M_GENERATE_STANDARD_COSTS.xml [^]
[7] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/functions/MA_PRODUCTION_COST.xml [^]
[8] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_SEQUENCEPRODUCT.xml [^]
[9] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/functions/MA_STANDARD_COST_SEQUENCE.xml [^]
[10] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_COSTCENTER.xml [^]
[11] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_COSTCENTER_VERSION.xml [^]
[12] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_INDIRECT_COST_VALUE.xml [^]
[13] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_MACHINE_COST.xml [^]
[14] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/MA_PL_INVOICELINE.xml [^]
[15] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/C_SALARY_CATEGORY_COST.xml [^]
[16] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/M_PRODUCTIONLINE.xml [^]
[17] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/M_INOUT.xml [^]
[18] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/tables/M_OFFER.xml [^]
A branch has been creted to solve these issues: https://dev.openbravo.com/websvn/openbravo/branches/multi-currency-cost/ [^]
1) Create the currency mandatory column in AD_CLIENT table (take care of sampledata and demo data). Add an onCreateDefault clause similar to:
<column name="C_CURRENCY_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
<default/>
<onCreateDefault>CASE WHEN AD_CLIENT_ID == 0 THEN '102' ELSE (SELECT C_ACCTSCHEMA.C_CURRENCY_ID FROM C_ACCTSCHEMA, AD_CLIENTINFO WHERE AD_CLIENTINFO.C_ACCTSCHEMA1_ID = C_ACCTSCHEMA.C_ACCTSCHEMA_ID) END</onCreateDefault>
</column>
2) Make changes in MA_STANDARD_COST_SEQUENCE process.
3) Make changes in M_GENERATE_AVERAGE_COSTS process.
4) Add a currency column to M_INOUT table to indicate the currency of FREIGHTAMT column. Modify the process that calculates this freight amount to update the value of this currency column.
No tags attached.
depends on backport 0007957 closed rafaroda Multi currency issues in some processes and tables 
related to defect 0005625 closed shuehner Improve messaging where there is no conversion rate 
related to defect 0005651 closed rafaroda New C_Currency_id column in M_Inout for Shipper Report 
related to defect 0010747 closed harikrishnan The ad_clientinfo.C_AcctSchema1_ID column is not filled when executing a initial client setup 
Issue History
2008-10-17 12:59rafarodaNew Issue
2008-10-17 12:59rafarodaAssigned To => rafaroda
2008-10-17 12:59rafarodasf_bug_id0 => 2174493
2008-10-17 12:59rafarodaRegression testing => No
2008-10-17 17:31rafarodaNote Added: 0009624
2008-10-17 17:32rafarodaSteps to Reproduce Updated
2008-10-17 17:46svnbotCheckin
2008-10-17 17:46svnbotNote Added: 0009626
2008-10-17 17:46svnbotsvn_revision => 8887
2008-10-17 17:56rafarodaSteps to Reproduce Updated
2008-10-17 19:20svnbotCheckin
2008-10-17 19:20svnbotNote Added: 0009627
2008-10-17 19:20svnbotsvn_revision8887 => 8894
2008-10-18 09:50rafarodaSteps to Reproduce Updated
2008-10-20 12:16psarobeStatusnew => scheduled
2008-10-20 12:16psarobeNote Added: 0009649
2008-10-20 12:16psarobefix_in_branch => trunk
2008-10-21 09:39rafarodaNote Added: 0009664
2008-10-21 19:10svnbotCheckin
2008-10-21 19:10svnbotNote Added: 0009670
2008-10-21 19:10svnbotsvn_revision8894 => 8997
2008-10-22 19:30svnbotCheckin
2008-10-22 19:30svnbotNote Added: 0009690
2008-10-22 19:30svnbotsvn_revision8997 => 9041
2008-10-22 19:37svnbotCheckin
2008-10-22 19:37svnbotNote Added: 0009691
2008-10-22 19:37svnbotsvn_revision9041 => 9043
2008-10-23 08:28svnbotCheckin
2008-10-23 08:28svnbotNote Added: 0009692
2008-10-23 08:28svnbotsvn_revision9043 => 9050
2008-10-23 11:18svnbotCheckin
2008-10-23 11:18svnbotNote Added: 0009695
2008-10-23 11:18svnbotStatusscheduled => resolved
2008-10-23 11:18svnbotResolutionopen => fixed
2008-10-23 11:18svnbotsvn_revision9050 => 9058
2008-10-23 11:24rafarodaNote Added: 0009696
2008-10-23 11:39rafarodaRelationship addedrelated to 0005625
2008-10-23 12:28svnbotCheckin
2008-10-23 12:28svnbotNote Added: 0009702
2008-10-23 12:28svnbotsvn_revision9058 => 9071
2008-10-24 11:05rafarodaRelationship addedrelated to 0005651
2008-12-08 16:39psarobeStatusresolved => closed
2008-12-08 16:39psarobeNote Added: 0011026
2009-03-05 09:21rafarodaIssue cloned0007957
2009-03-05 09:21rafarodaRelationship addeddepends on 0007957
2009-09-25 07:01rafarodaRelationship addedrelated to 0010747

Notes
(0009624)
rafaroda   
2008-10-17 17:31   
Final steps for this:
* Update demodata of the installer:
SELECT * FROM AD_CLIENT;

SELECT * FROM AD_CLIENTINFO;

SELECT * FROM C_ACCTSCHEMA;

SELECT C_ACCTSCHEMA.C_CURRENCY_ID
FROM C_ACCTSCHEMA, AD_CLIENTINFO, AD_CLIENT
WHERE AD_CLIENT.AD_CLIENT_ID = AD_CLIENTINFO.AD_CLIENT_ID
AND AD_CLIENTINFO.C_ACCTSCHEMA1_ID = C_ACCTSCHEMA.C_ACCTSCHEMA_ID

* Make Initial Client Setup compatible with this feature.

* Update the User Manual and Functional Documentation.
(0009626)
svnbot   
2008-10-17 17:46   
Repository: openbravo
Revision: 8887
Author: rafaroda
Date: 2008-10-17 17:46:25 +0200 (Fri, 17 Oct 2008)

Issue 0005564 1) Created the currency mandatory column in AD_CLIENT table (onCreateDefault is still missing).

---
U branches/multi-currency-cost/src-db/database/model/tables/AD_CLIENT.xml
U branches/multi-currency-cost/src-db/database/sampledata/AD_CLIENT.xml
U branches/multi-currency-cost/src-db/database/sourcedata/AD_CLIENT.xml
U branches/multi-currency-cost/src-db/database/sourcedata/AD_COLUMN.xml
U branches/multi-currency-cost/src-db/database/sourcedata/AD_FIELD.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=8887&sc=1 [^]
(0009627)
svnbot   
2008-10-17 19:20   
Repository: openbravo
Revision: 8894
Author: rafaroda
Date: 2008-10-17 19:20:56 +0200 (Fri, 17 Oct 2008)

Issue 0005564 3) Made changes in M_GENERATE_AVERAGE_COSTS process to allow multi currency.

---
U branches/multi-currency-cost/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=8894&sc=1 [^]
(0009649)
psarobe   
2008-10-20 12:16   
That needs to backport
(0009664)
rafaroda   
2008-10-21 09:39   
Issues found also in:
1) M_GET_PRODUCT_PRICE_DATE: takes PRICESTD from M_PRODUCTPRICE depending on a date. Conversion required to base currency.
2) M_GET_PRODUCT_PRICE: takes PRICESTD from M_PRODUCTPRICE with date now(). Conversion required to base currency.
3) M_GET_PURCHASE_PRICE: takes PRICEACTUAL from INVOICELINE or ORDERLINE or PRICESTD from M_PRODUCTPRICE. Conversion required to base currency.
(0009670)
svnbot   
2008-10-21 19:10   
Repository: openbravo
Revision: 8997
Author: rafaroda
Date: 2008-10-21 19:10:47 +0200 (Tue, 21 Oct 2008)

Issue 0005564 Modified functions:
* M_GET_PRODUCT_PRICE_DATE
* M_GET_PRODUCT_PRICE
* M_GET_PURCHASE_PRICE

---
U branches/multi-currency-cost/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml
U branches/multi-currency-cost/src-db/database/model/functions/M_GET_PRODUCT_PRICE.xml
U branches/multi-currency-cost/src-db/database/model/functions/M_GET_PRODUCT_PRICE_DATE.xml
U branches/multi-currency-cost/src-db/database/model/functions/M_GET_PURCHASE_PRICE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=8997&sc=1 [^]
(0009690)
svnbot   
2008-10-22 19:30   
Repository: openbravo
Revision: 9041
Author: rafaroda
Date: 2008-10-22 19:30:10 +0200 (Wed, 22 Oct 2008)

Issue 0005564 Modified procedures:
* MA_STANDARD_COST
* MA_STANDARD_COST_SEQUENCE

---
U branches/multi-currency-cost/src-db/database/model/functions/MA_STANDARD_COST.xml
U branches/multi-currency-cost/src-db/database/model/functions/MA_STANDARD_COST_SEQUENCE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=9041&sc=1 [^]
(0009691)
svnbot   
2008-10-22 19:37   
Repository: openbravo
Revision: 9043
Author: rafaroda
Date: 2008-10-22 19:37:44 +0200 (Wed, 22 Oct 2008)

Issue 0005564 Updated M_GET_PRODUCT_PRICE_DATE function

---
U branches/multi-currency-cost/src-db/database/model/functions/M_GET_PRODUCT_PRICE_DATE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=9043&sc=1 [^]
(0009692)
svnbot   
2008-10-23 08:28   
Repository: openbravo
Revision: 9050
Author: rafaroda
Date: 2008-10-23 08:28:56 +0200 (Thu, 23 Oct 2008)

Issue 0005564 Updated C_CURRENCY_RATE function

---
U branches/multi-currency-cost/src-db/database/model/functions/C_CURRENCY_RATE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=9050&sc=1 [^]
(0009695)
svnbot   
2008-10-23 11:18   
Repository: openbravo
Revision: 9058
Author: rafaroda
Date: 2008-10-23 11:17:33 +0200 (Thu, 23 Oct 2008)

Fixes bug 0005564 Solves multi currency issues in some functions and procedures.

---
U trunk/src/org/openbravo/erpCommon/utility/Utility.java
U trunk/src/org/openbravo/erpCommon/utility/Utility_data.xsql
U trunk/src-db/database/model/functions/C_CURRENCY_CONVERT.xml
U trunk/src-db/database/model/functions/C_CURRENCY_RATE.xml
U trunk/src-db/database/model/functions/MA_STANDARD_COST.xml
U trunk/src-db/database/model/functions/MA_STANDARD_COST_SEQUENCE.xml
U trunk/src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml
U trunk/src-db/database/model/functions/M_GET_PRODUCT_PRICE.xml
U trunk/src-db/database/model/functions/M_GET_PRODUCT_PRICE_DATE.xml
U trunk/src-db/database/model/functions/M_GET_PURCHASE_PRICE.xml
U trunk/src-db/database/model/tables/AD_CLIENT.xml
U trunk/src-db/database/sampledata/AD_CLIENT.xml
U trunk/src-db/database/sourcedata/AD_CLIENT.xml
U trunk/src-db/database/sourcedata/AD_COLUMN.xml
U trunk/src-db/database/sourcedata/AD_FIELD.xml
U trunk/src-db/database/sourcedata/AD_MESSAGE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=9058&sc=1 [^]
(0009696)
rafaroda   
2008-10-23 11:24   
Updated demo data: https://dev.openbravo.com/websvn/packaging/?rev=191&sc=1 [^]
(0009702)
svnbot   
2008-10-23 12:28   
Repository: openbravo
Revision: 9071
Author: rafaroda
Date: 2008-10-23 12:28:54 +0200 (Thu, 23 Oct 2008)

Fixes bug 0005564 Small fixes in functions.

---
U trunk/src-db/database/model/functions/C_CURRENCY_RATE.xml
U trunk/src-db/database/model/functions/M_GET_PRODUCT_PRICE.xml
U trunk/src-db/database/model/functions/M_GET_PURCHASE_PRICE.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=9071&sc=1 [^]
(0011026)
psarobe   
2008-12-08 16:39   
Cannot be verify