Product_onchange apply wrong the currency rate on price : always consider latest date.

Bug #812261 reported by Salvi Angjeli
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

Here I have found the entry point problem regarding currency rate in account invoice, when I am creating account invoice with other then current date the related price comes wrongly in account invoice line sue to latest rate multiplication.So It always pass wrong price in subtotal.

Related branches

Revision history for this message
Salvi Angjeli (salvi-angjeli) wrote :
Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Salvi Angjeli,

Thanks for reporting, i have checked your patch and it works fine. So the bug is fixed with Revision ID and Revision Number as follows:

Revision ID : <email address hidden>
Revision Number : 4903

The solution will be merged in addons soon.

Thanks & Regards,
Devnani Bharat R.

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Confirmed
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Salvi Angjeli,

I have again tested the scenario mentioned by you. The previous version is working fine.
So, following is the test case :

Invoice Date : 08/02/2011
Currency : AUD

In Currency Rates
---------------------------

Date Rate
2011-05-02 5.0
2011-01-01 1.407

Invoice Lines
--------------------

[CPU_GEN] Regular processor config X2001 Product Sales - (test) 1.0 PCE 300.0 0.0 False
[HDD1] HDD Seagate 7200.8 80GB X2001 Product Sales - (test) 1.0 PCE 50.0 0.0 False

After Validating it generates

Invoice Debit Credit Amount Currency Currency

SAJ/2011/023 70.0 0.0 False 350.0 AUD ($) False 0.0 valid False False

SAJ2011023 SAJ/2011/023 [HDD1] HDD Seagate 7200.8 80GB Agrolait X2001 Product Sales - (test) False 0.0 10.0 False -50.0 AUD ($) False 0.0 valid False False

SAJ2011023 SAJ/2011/023 [CPU_GEN] Regular processor config Agrolait X2001 Product Sales - (test) False 0.0 60.0 False -300.0 AUD ($) False 0.0 valid False False

Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Salvi Angjeli,

Please ignore #3 Comment, I have again tested the scenario mentioned by you. The previous version is working fine. So, following is the test case :

Invoice Date : 08/02/2011
Currency : AUD

In Currency Rates
---------------------------

Date Rate
2011-05-02 5.0
2011-01-01 1.407

Invoice Lines
-------------------

[CPU_GEN] Regular processor config X2001 Product Sales - (test) 1.0 PCE 300.0 0.0 False

[HDD1] HDD Seagate 7200.8 80GB X2001 Product Sales - (test) 1.0 PCE 50.0 0.0 False

After Validating it generates.

Invoice Debit Credit Amount Currency Currency

SAJ/2011/023 70.0 0.0 350.0 AUD ($)

SAJ/2011/023 0.0 10.0 50.0 AUD ($)

SAJ/2011/023 0.0 60.0 300.0 AUD ($)

By this we can see that 350 / 5 (Rate on 2011-05-02) which is 70 is Debited. As Invoice Date is 08/02/2011, the system will consider less than date i.e 2011-05-02 in order to calculate Amount Currency.

Thanks & Regards,
Devnani Bharat R.

Revision history for this message
Salvi Angjeli (salvi-angjeli) wrote :

Hello Devnani,

This is the test case in my case:

Invoice Date: 08/01/2011
Currrency: AUD
Payment term: I create a payment term where 50% is compute now and 50% 30 days later

----------------------------------

Date rate
08/01/2011 5.0
08/02/2011 1.0

Invoice Lines
-------------------------------

[CPU_GEN] Regular processor config X2001 Product Sales - (test) 1.0 PCE 300.0 0.0 False

[HDD1] HDD Seagate 7200.8 80GB X2001 Product Sales - (test) 1.0 PCE 50.0 0.0 False

The validation of invoice is done 08/02/2011:

account move lines generated without the patch:

Invoice Debit Credit Amount Currency Currency

SAJ/2011/023 175.0 0.0 175.0 AUD ($)

SAJ/2011/023 175.0 0.0 1750.0 AUD ($)

SAJ/2011/023 0.0 50.0 50.0 AUD ($)

SAJ/2011/023 0.0 300.0 300.0 AUD ($)

This is not correct because the currency rate used by the system is the currency rate of the day of validation and not the currency of the invoice date

account move lines generated with the patch:

Invoice Debit Credit Amount Currency Currency

SAJ/2011/023 35 0.0 175.0 AUD ($)

SAJ/2011/023 35.0 0.0 1750.0 AUD ($)

SAJ/2011/023 0.0 10.0 50.0 AUD ($)

SAJ/2011/023 0.0 60.0 300.0 AUD ($)

Thanks.

Regards
Salvi Angjeli

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Hello Salvi,

Thanks for the example.

I have checked the test case given by you in last comment but i still not able to get problem.

I am getting entries which are same as appeared as correct result on your side.

Invoice Debit Credit Amount Currency Currency
SAJ/2011/023 35 0.0 175.0 AUD ($)
SAJ/2011/023 35.0 0.0 1750.0 AUD ($)
SAJ/2011/023 0.0 10.0 50.0 AUD ($)
SAJ/2011/023 0.0 60.0 300.0 AUD ($)

So i again request you to update your branch with latest changes in trunk and if you have still problem after updating you can get back to us.
For you reference i am attaching screenshots of invoice, you can check it.

Thanks,
Mustufa Rangwala

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :
Changed in openobject-addons:
status: Fix Committed → Confirmed
summary: - problem with the compute currency of account move line of an invoice
+ Product_onchange apply wrong the currency rate on price : always
+ consider latest date.
description: updated
Revision history for this message
Salvi Angjeli (salvi-angjeli) wrote :

Hello Mustafa,

Thanks for the reply.
I realized for the invoice screenshot that the invoice date is the same with the validation date (08/01/2011), correct me if i am wrong. In this case everything works fine like in your example.

In my case the problem is when the invoice date is different from the the validation date and the currency rate is different between this two days. In your example will be like this:

Invoice created in 08/01/2011
Validation of invoice 09/01/2011, with invoice date forced in (08/01/2011)

Currency rates
08/01/2011 5
09/01/2011 1

In this case the result will be different for the one expected (the system should take in consideration the invoice date currency rate and not the validation date currency rate)

Reagards
Salvi Angjeli

Changed in openobject-addons:
status: Confirmed → In Progress
Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Salvi,

We have tracked the problem of the bug, and it seems your patch is quite reasonable to solve the issue you faced, so i have applied your patch with little modification. Thanks for your valuable time, and patience. The solution of this bug will be merged in addons soon.

Thanks & Regards,
Devnani Bharat R.

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
qdp (OpenERP) (qdp) wrote :

fix released in revision 5076 of trunk addons

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.