← Back to team overview

openerp-india team mailing list archive

[Bug 1066066] Re: res_partner.credit and debit do not always return correct values

 

the formula as programmed only works if called as function field from
res_partner.


if called "stand alone" it returns wrong values as described

    def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
        query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
        cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
                      FROM account_move_line l
                      LEFT JOIN account_account a ON (l.account_id=a.id)
                      WHERE a.type IN ('receivable','payable')
                      AND l.partner_id IN %s
                      AND l.reconcile_id IS NULL
                      AND """ + query + """
                      GROUP BY l.partner_id, a.type
                      """,
                   (tuple(ids),))
        maps = {'receivable':'credit', 'payable':'debit' }
        res = {}
        for id in ids:
            res[id] = {}.fromkeys(field_names, 0)
        for pid,type,val in cr.fetchall():
            if val is None: val=0
            res[pid][maps[type]] = (type=='receivable') and val or -val
        return res

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1066066

Title:
  res_partner.credit and debit do not always return correct values

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  for line in account_move_line_obj.browse(cr, uid, ids) :

  line.partner_id.credit is always 0

  line.partner_id.debit
            positive value => credit
            negative value => debit

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1066066/+subscriptions


References