Residual amount for foriegn currency invoice

Bug #461617 reported by nullpointer
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Company currency is CHF (Swiss Francs)
Invoice created at 1.10.2009 in Euro, currency rate 0.659 -> 2907 Euro == 4411.23 CHF (no tax)
Invoice payment at 25.10.2009 in Swiss Francs, rate 0.65 -> 2907 Euro == 4435.50 CHF (no tax)

Invoice is marked s 'Done' with Residual amount of 39.70 Euro. The calculation in OpenERP:

4411.23 / 0.65 = 2867.30
2907 - 2867.30 = 39.70

is IMO wrong, because it takes debit amount (4411.23) instead of payed amount (4435.50) for the residual calculation, i.e. makes a mix of plan/debit and is/bank amounts. Booking in chart of accounts are OK.

Version 5.0.0-3.1

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Try the last version, this problem is fixed I think

Revision history for this message
nullpointer (robert-dbservice) wrote :

Just installed - 5.0.6, same problem. Which module calculates the rsidual amount?

Revision history for this message
Jan Verlaan (jan-verlaan) wrote :

Module account -> source invoice.py ->

def _amount_residual(self, cr, uid, ids, name, args, context=None):
        res = {}
        data_inv = self.browse(cr, uid, ids)
        cur_obj = self.pool.get('res.currency')
        for inv in data_inv:
            debit = credit = 0.0
            for lines in inv.move_lines:
                if lines.account_id.company_currency_id.id <> inv.currency_id.id:
                    if lines.debit:
                        debit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.debit)
                    if lines.credit:
                        credit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.credit)
                else:
                    debit += lines.debit
                    credit += lines.credit

            if not inv.amount_total:
                result = 0.0
            elif inv.type in ('out_invoice','in_refund'):
                result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total))
            else:
                result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total))
            res[inv.id] = round(result,int(config['price_accuracy']))
        return res

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi !

You're right, the trouble seems always here ! ! Ha, I knew that something strange with that bugs...

Please continue reporting stuff on this one :

https://bugs.launchpad.net/bugs/427869

Regards,

Joël

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.