← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 511104] Re: Pay invoice wizard regression in foreign currency

 

Hello Quentin,


I'm really happy to see you on that bug : it started to drive us crazy over here ! 

Your patch doesn't handle that well unfortunately, depending on that
exchange rate, the rounding is not good on the first partial payment,
making a diff of 0,01 cts. Here is where it breaks :

      Given the company currency is set to EUR
      And the following currency rate settings are:
      |code|rate|name|
      |EUR|1.000|01-01-2009|
      |CHF|1.644|01-01-2009|
      |CHF|1.500|09-09-2009|
      |CHF|0.6547|10-10-2009|
      |USD|1.3785|01-01-2009|

      Given a cash journal in USD exists
      And a cash journal in CHF exists
      And a cash journal in EUR exists
      And on all journal entries can be canceled

    Given I have recorded on the 1 jan 2009 a supplier invoice (in_invoice) of 1000,0 CHF without tax called
    When I press the validate button
    Then I should see the invoice MySupplierInvoicePayWizard open
    When I call the Pay invoice wizard
    And I partially pay 200.0 CHF.- on the 10 jan 2009
    Then I should see a residual amount of 800.0 CHF.-

ERROR:
      expected: 800.0,
      got: 800.01 (using ==)


What's interesting here is that if I set the expected result after first payment to 800.01, the tests pass (See #12 for complete test) !!!

Another example where it doesn't work (same company & currency
settings). It gives you 2 errors here, after the first payment (always a
0,01 diff), but then, it's become worst...

    Given I have recorded on the 1 jan 2009 a supplier invoice (in_invoice) of 450,0 USD without tax called InvoicePayWizard3 
    When I press the validate button  
    Then I should see the invoice MySupplierInvoicePayWizard3 open 
    When I call the Pay invoice wizard                                                    
    And I partially pay 200.0 USD.- on the 2 feb 2009                         
    Then I should see a residual amount of 250.00 USD.-     

ERROR
      expected: 250.0,
      got: 249.99 (using ==)
             
    When I call the Pay invoice wizard                                                  
    And I partially pay 300.0 CHF.- on the 2 feb 2009                          
    Then I should see a residual amount of -59.68 USD.-                    

ERROR        
       expected: -59.68,
       got: -1.56 (using ==)
      
    When I call the Pay invoice wizard                                               
    And I finally paid 30.0 USD.- on the 2 feb 2009                           
    Then I should see a residual amount of 0.0 USD.-                        
    And I should see the invoice MySupplierInvoicePayWizard3 paid    


Well, I strongly suggest to reproduce our test condition in order to test those complex cases. Just set the good exchange rate at the right date. Pay attention to respect the dates in all operations.


Thank you very much for taking time on this one !!


Best regards,

Joël

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/511104

Title:
  Pay invoice wizard regression in foreign currency

Status in OpenObject Addons Modules:
  In Progress

Bug description:
  Hi !


There is a regression introduce by commit 2537 into addons on the pay invoice wizard !

The amount in currency are wrongly computed !!!

Here the test case :
  Background:
      Given I am loged as admin user with password admin used
      And the company currency is set to EUR 
      And the following currency rate settings are:
      |code|rate|name|
      |EUR|1.000|01-01-2009|
      |CHF|1.644|01-01-2009|
      |CHF|1.500|09-09-2009|
      |CHF|0.6547|10-10-2009|
      |USD|1.3785|01-01-2009|
      And a cash journal in USD exists
      And a cash journal in CHF exists
      And a cash journal in EUR exists

    Scenario: make_and_validate_payments_with_pay_invoice_wizard
      Given I have recorded on the 1 jan 2009 a supplier invoice (in_invoice) of 1000,0 CHF without tax called MySupplierInvoicePayWizard
      When I press the validate button
      Then I should see the invoice MySupplierInvoicePayWizard open

      When I call the Pay invoice wizard
      And I partially pay 200.0 CHF.- on the 10 jan 2009
      Then I should see a residual amount of 800.0 CHF.-
      
      When I call the Pay invoice wizard
      And I partially pay 200.0 USD.- on the 11 jan 2009
      Then I should see a residual amount of 561.48 CHF.-
      
CRASH HERE  expected: 561.48,
           got: 600.0 (using ==)


      When I call the Pay invoice wizard
      And I partially pay 200.0 EUR.- on the 12 jan 2009
      Then I should see a residual amount of 232.68 CHF.-
      
      When I call the Pay invoice wizard
      And I completely pay the residual amount in CHF on the 13 sep 2009
      Then I should see a residual amount of 0.0 CHF.-
      And I should see the invoice MySupplierInvoicePayWizard paid


THANKS TO REVERT THIS COMMIT ASAP !!

Regards,