Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0009487Openbravo ERP07. Sales managementpublic2009-06-11 18:482009-06-17 09:40
networkb 
rafaroda 
immediatecriticalalways
closedfixed 
30
2.40MP4 
2.40MP6 
Core
No
0009487: Is not possible to complete a invoice using a different currency if it has not conversion to the date obtained of payment terms
Is not possible to complete a invoice using a different currency if it has not conversion to the date obtained of payment terms.
-Create a price list with a currency different than the standard.
-This currency has a conversion rate with the standard to the date of today
but the conversion is not available in the future (i.e. in one or two months)
-Create a sales invoice with the price list created before.
-select payment terms "two month"
-Create a line.
-Complete the invoice line and you get a error.

-If you reactivate the invoice and change the payment terms to immediate
the invoice is completed properly.
* The problem is in C_BP_SOCREDITUSED_REFRESH function which updates the credit used by the business partner.
* This function is called both from C_INVOICE_POST and C_SETTLEMENT_POST.
* In order to make the amount conversion, the date taken by this function is the debt payment planned (due) date, which is wrong because customers burn credit in the moment that the document (invoice or settlement) is completed, not when the payment is done (that can happen far in the future or even never happen).
* The date to be taken by this function is the one that generates the debt payment: if it is an invoice, take the invoice date; if it is a settlement, take the settlement transaction date (if it does not come from an invoice, otherwise take the date invoiced).

For this, a new column DOCDATE needs to be added to C_DEBT_PAYMENT_V view.
No tags attached.
blocks defect 0009447 closed rafaroda Is not possible to complete a invoice using a different currency if it has not conversion to the date obtained of payment terms 
Issue History
2009-06-15 18:41rafarodaTypedefect => backport
2009-06-15 18:41rafarodafix_in_branch => 2.40
2009-06-16 16:45hgbotCheckin
2009-06-16 16:45hgbotNote Added: 0017355
2009-06-16 16:45hgbotStatusscheduled => resolved
2009-06-16 16:45hgbotResolutionopen => fixed
2009-06-16 16:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/stable/2.40/rev/9b9784371aa4a593b2459f3460888c5e4727fb0f [^]
2009-06-16 16:45rafarodaNote Added: 0017356
2009-06-16 22:52psarobeStatusresolved => closed
2009-06-17 09:40psarobeFixed in Version => 2.40MP6

Notes
(0017355)
hgbot   
2009-06-16 16:45   
Repository: erp/stable/2.40
Changeset: 9b9784371aa4a593b2459f3460888c5e4727fb0f
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Tue Jun 16 16:42:15 2009 +0200
URL: http://code.openbravo.com/erp/stable/2.40/rev/9b9784371aa4a593b2459f3460888c5e4727fb0f [^]

Fixes issue 0009487 Now conversion rate date is properly taken in C_BP_SOCREDITUSED_REFRESH function.

---
M src-db/database/model/functions/C_BP_SOCREDITUSED_REFRESH.xml
M src-db/database/model/views/C_DEBT_PAYMENT_V.xml
---
(0017356)
rafaroda   
2009-06-16 16:45   
Steps to test this fix:
1) Create a sales price list in Russian Rubles (RUB).
2) Create a price list version.
3) Create some prices for some products (in Rubles).
4) Create a new customer business partner and give him an address.
5) In customer tab give him:
* The price list created in Rubles.
* Form of Payment: Bank Deposit
* Payment Terms: One month
* Credit Limit: 100 (please notice that this limit is give in the base currency of the Entity, not the currency of customer's price list).
6) Create a conversion rate from RUB to your base currency with dates today until tomorrow and with multiplier 0.5 (1 RUB = 0.5 your Entity base currency)
7) Create a conversion rate from your base currency to RUB with dates today until tomorrow and with multiplier 2 (1 Entity base currency = 2 RUB)
8) Create new AR sales invoice for your new customer for date today: price list is in RUB and payment terms is One month.
9) Create a line with Line Net Amount = 100 (RUB) and Tax 16%.
10) Create a Payment line in this same invoice with Due Date = today + 1 month and Amount 20 with currency your base currency
11) Go back to invoice header and complete this invoice.
12) Go back to Payment tab and check that a new payment has been created for due date today + 1 month with Amount = 76 (RUB): 76 RUB = 116 RUB - 40 RUB (2 x 20 your base currency which comes from first payment in step 10).
13) Go to business partner customer's tab and check that Credit Used read-only field is 58 (in your Entity base currency): 116 (RUB) * 0.5
14) Create a new Settlement with transaction date today and currency your base currency.
15) Click on Create Lines From, select your business partner and click on Search.
16) Select the 76 RUB line and click on OK.
17) Go to Created Payments tab and create a new one with:
* Business Partner your customer
* Due Date = today + 1 month
* Amount = 76 with currency RUB
18) Go back to header and click on process: check that Canceled/Not Charged and Created Amount read-only fields equal 38 (in your base currency)
19) Create a new Bank Statement with transaction date today.
20) Click on Create Lines From, select your customer, leave Account drop-down blank and click on Search.
21) Select line of 76 RUB and click on OK.
22) Check that Ending Balance read-only field equals 38 (in your base currency).
23) Click on Process button: your customer has paid you, let's check that his credit used has decreased.
24) Go to business partner customer's tab and check that Credit Used read-only field is 20 (in your Entity base currency) which corresponds to the remaining payment.