← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 672479] Re: Account_payment_extension, incorrect debt calculation

 

Hello,

i assigned the author of the module for him to be alterted but as this
bug doesn't affect our project addons i'm closing it.

Thanks for the contribution,
Quentin

** Project changed: openobject-addons => openobject-extra-addons

** Changed in: openobject-extra-addons
     Assignee: (unassigned) => Zikzakmedia (zikzak)

** Project changed: openobject-extra-addons => openobject-addons

** Changed in: openobject-addons
       Status: New => Won't Fix

-- 
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.

Status in OpenObject Addons Modules: Won't Fix

Bug description:
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!





References