Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0009447Openbravo ERP07. Sales managementpublic2009-06-11 18:482009-06-27 00:00
networkb 
rafaroda 
immediatecriticalalways
closedfixed 
30
2.40MP4 
main 
Core
No
0009447: 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.
depends on backport 0009487 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 
related to defect 0009507 closed rafaroda api check: build 50 failed 
png ConversionRate.png (81,993) 2009-06-12 16:26
https://issues.openbravo.com/file_download.php?file_id=1426&type=bug
png
Issue History
2009-06-11 18:48networkbNew Issue
2009-06-11 18:48networkbAssigned To => rafaroda
2009-06-12 16:15rafarodaNote Added: 0017269
2009-06-12 16:15rafarodaStatusnew => feedback
2009-06-12 16:16rafarodaNote Added: 0017270
2009-06-12 16:16rafarodaSeveritycritical => major
2009-06-12 16:26rafarodaFile Added: ConversionRate.png
2009-06-12 17:00networkbNote Added: 0017273
2009-06-12 17:00networkbStatusfeedback => new
2009-06-15 10:52networkbSeveritymajor => critical
2009-06-15 18:40rafarodaSteps to Reproduce Updated
2009-06-15 18:41rafarodaStatusnew => scheduled
2009-06-15 18:41rafarodafix_in_branch => pi
2009-06-16 18:55hgbotCheckin
2009-06-16 18:55hgbotNote Added: 0017362
2009-06-16 18:55hgbotStatusscheduled => resolved
2009-06-16 18:55hgbotResolutionopen => fixed
2009-06-16 18:55hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/bf2ae654c0cc3d5838a2a62c26c8789a49badda2 [^]
2009-06-16 18:56rafarodaNote Added: 0017363
2009-06-17 08:16rafarodaRelationship addedrelated to 0009507
2009-06-22 11:09psarobeFixed in Version => main
2009-06-26 17:25psarobeStatusresolved => closed
2009-06-27 00:00anonymoussf_bug_id0 => 2813027

Notes
(0017269)
rafaroda   
2009-06-12 16:15   
This is not an issue but the expected behavior.

1) Create a sales price list in Japanese Yens.
2) Create a price list version.
3) Create some prices for some products (in Yens).

Do NOT create any currency conversion rate from Yens to Euro.

4) Create a Sales Invoice with Payment Tems = Immediate (forget about the payment terms) and the price list in Japanese Yens.
5) Create some lines.
5) Go back to invoice header and complete it.

You will get "There is no conversion rate defined from (JPY-¥) to (EUR-€) for date '12-06-2008', Client 'BigBazaar' and Organization 'Main'." error message.

When completing an invoice, C_Invoice_Post process makes some conversions from the invoice currency (JPY-¥) to (EUR-€). If you are using payment terms in the future, the due date is correctly taken and is the one used for the conversion (and makes sense that you do not have conversion rates yet defined).

Do you think that if there is no conversion rate in the future, the invoice date should be taken?
(0017270)
rafaroda   
2009-06-12 16:16   
Downgraded to major http://wiki.openbravo.com/wiki/Bug_Reporting_Guidelines#How_to_Choose_the_Right_Severity [^]
(0017273)
networkb   
2009-06-12 17:00   
This is a critical issue because a customer that was in 2.40mp3 was able to complete invoices properly. He has update the environment to 2.40mp4 and now
he can not complete invoices and he can't unprocess the invoices that were completed on the 2.40mp3 release
(0017362)
hgbot   
2009-06-16 18:55   
Repository: erp/devel/pi
Changeset: bf2ae654c0cc3d5838a2a62c26c8789a49badda2
Author: Rafa Roda Palacios <rafael.roda <at> openbravo.com>
Date: Tue Jun 16 18:50:53 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/bf2ae654c0cc3d5838a2a62c26c8789a49badda2 [^]

Fixes issue 0009447 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
---
(0017363)
rafaroda   
2009-06-16 18:56   
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 reamining payment.