← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 672479] [NEW] Account_payment_extension, incorrect debt calculation

 

You have been subscribed to a public bug:

Using 5.15, I try to pay one supplier throught the "payable payment" menu. I create a new paiement order and then click on "Select invoices to pay/receive payment".
Some invoices do not appear in the list which are clearly unpaid. I went to analyze the code and cannot understand current calculation which seems to me wrong as it is (in account_payment_extension/account_line_move.py/def amount_to_pay).
eg: invoice supplier total= 1500. Paid= 800, amount to be paid still =700.
If I take the following code and print the variables
(...)
            else:
                if not unreconciled:
                    unreconciled = debt
                if debt > 0:
                    debt = min(debt - paid, max(0.0, unreconciled - paid))
                else:
                    debt = max(debt - paid, min(0.0, unreconciled - paid))
(...)
I have debt = 1500, which is correct
I have paid = 800, which is correct
I have unreconciled = 700 which is still correct.
But then if I make the calculation according to those variable, I get the following:
debt = min (1500 - 800, max (0, 700-800)) = min(700,0) = 0 and the invoice never appears in the list!
I do not understand fully understand the meaning/need of above "if test" but it seems to me its purpose is to take the min quantity between the payment system and the reconcilied invoice system as the 2 systems work independantly. I would then propose better this code, which fits my way of working:

                if debt > 0:
#                    debt = min(debt - paid, max(0.0, unreconciled - paid))
                    debt = min(debt - paid, max(0.0, unreconciled))
                else:
#                    debt = max(debt - paid, min(0.0, unreconciled - paid))
                    debt = max(debt - paid, min(0.0, unreconciled))
In this case if both payment system and reconciled system are synchronised or not, the information is always correct.

Still not completely sure of all the impacts so advises are welcome!

** Affects: openobject-addons
     Importance: Undecided
     Assignee: Zikzakmedia (zikzak)
         Status: New

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



References