Skip to content
Snippets Groups Projects
  • Nicolas Martinelli's avatar
    e8906826
    [FIX] account: invoice analysis · e8906826
    Nicolas Martinelli authored
    - Create a customer invoice of 100, validate
    - Refund the invoice
    - Go to Accounting > Reports > Business Intelligence > Invoices
    - A total of 200 is shown, while it should be 0.
    - The same occurs with a vendor bill (-200 instead of 0)
    
    The invoice lines have their sign modified at two places when used in
    the report:
    - in method `_compute_price` of `account.invoice.line`
    - in method `_from` of `account.invoice.report`
    
    The signs are computed with the following combination:
    
    |Invoice type|`_compute_price`|`_from`|Report sign|
    |------------|----------------|-------|-----------|
    |out_invoice |              +1|     +1|         +1|
    |in_invoice  |              +1|     -1|         -1|
    |out_refund  |              -1|     -1|         +1|
    |in_refund   |              -1|     +1|         -1|
    
    This is not correct: out_invoice and out_refund should have opposite
    signs. Same applies to in_invoice and in_refund.
    
    opw-772479
    Closes #19954
    e8906826
    History
    [FIX] account: invoice analysis
    Nicolas Martinelli authored
    - Create a customer invoice of 100, validate
    - Refund the invoice
    - Go to Accounting > Reports > Business Intelligence > Invoices
    - A total of 200 is shown, while it should be 0.
    - The same occurs with a vendor bill (-200 instead of 0)
    
    The invoice lines have their sign modified at two places when used in
    the report:
    - in method `_compute_price` of `account.invoice.line`
    - in method `_from` of `account.invoice.report`
    
    The signs are computed with the following combination:
    
    |Invoice type|`_compute_price`|`_from`|Report sign|
    |------------|----------------|-------|-----------|
    |out_invoice |              +1|     +1|         +1|
    |in_invoice  |              +1|     -1|         -1|
    |out_refund  |              -1|     -1|         +1|
    |in_refund   |              -1|     +1|         -1|
    
    This is not correct: out_invoice and out_refund should have opposite
    signs. Same applies to in_invoice and in_refund.
    
    opw-772479
    Closes #19954