← Back to team overview

openerp-india team mailing list archive

[Bug 1188923] Re: Select multiple Customer Payment to print gives wrong writeoff amount

 

[Expired for OpenERP Addons because there has been no activity for 60
days.]

** Changed in: openobject-addons
       Status: Incomplete => Expired

-- 
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/1188923

Title:
  Select multiple Customer Payment to print gives wrong writeoff amount

Status in OpenERP Addons (modules):
  Expired

Bug description:
  I have come to know this bug when try to print multiple files of
  Customer Payment at the same time.

  When print > 1 file, the writeoff amount will also use amount from
  other file to add up!

  Here is the existing problem code,
  --------------------------------------------------
      def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
          if not ids: return {}
          currency_obj = self.pool.get('res.currency')
          res = {}
          debit = credit = 0.0
          for voucher in self.browse(cr, uid, ids, context=context):
              sign = voucher.type == 'payment' and -1 or 1
              for l in voucher.line_dr_ids:
                  debit += l.amount
              for l in voucher.line_cr_ids:
                  credit += l.amount
              currency = voucher.currency_id or voucher.company_id.currency_id
              res[voucher.id] =  currency_obj.round(cr, uid, currency, voucher.amount - sign * (credit - debit))
          return res

  If you notice, the debit and credit is not reset to 0.0 when loop through the next voucher.
  ---------------------------------------------------------------------------------------------------------------------------

      def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
          if not ids: return {}
          currency_obj = self.pool.get('res.currency')
          res = {}
          # debit = credit = 0.0  # delete here <-----------------------
          for voucher in self.browse(cr, uid, ids, context=context):
              debit = credit = 0.0 # add here <-------------------------
              sign = voucher.type == 'payment' and -1 or 1
              for l in voucher.line_dr_ids:
                  debit += l.amount
              for l in voucher.line_cr_ids:
                  credit += l.amount
              currency = voucher.currency_id or voucher.company_id.currency_id
              res[voucher.id] =  currency_obj.round(cr, uid, currency, voucher.amount - sign * (credit - debit))
          return res

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