← Back to team overview

openerp-india team mailing list archive

[Bug 1302625] [NEW] Skipping quants in _account_move_line

 

Public bug reported:

    def _create_account_move_line(self, cr, uid, quants, move, credit_account_id, debit_account_id, journal_id, context=None):
        #group quants by cost
        quant_cost_qty = {}
        for quant in quants:
            if quant_cost_qty.get(quant.cost):
                quant_cost_qty[quant.cost] += quant.qty
            else:
                quant_cost_qty[quant.cost] = quant.qty
        move_obj = self.pool.get('account.move')
        for cost, qty in quant_cost_qty.items():
            move_lines = self._prepare_account_move_line(cr, uid, move, qty, cost, credit_account_id, debit_account_id, context=context)
            return move_obj.create(cr, uid, {'journal_id': journal_id,
                                      'line_id': move_lines,
                                      'period_id': self.pool.get('account.period').find(cr, uid, move.date, context=context)[0],
                                      'date': move.date,
                                      'ref': move.picking_id and move.picking_id.name}, context=context)

return breaks the for loop and thus only one quant is reported...

** Affects: openobject-addons
     Importance: Undecided
         Status: New

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

Title:
  Skipping quants in _account_move_line

Status in OpenERP Addons (modules):
  New

Bug description:
      def _create_account_move_line(self, cr, uid, quants, move, credit_account_id, debit_account_id, journal_id, context=None):
          #group quants by cost
          quant_cost_qty = {}
          for quant in quants:
              if quant_cost_qty.get(quant.cost):
                  quant_cost_qty[quant.cost] += quant.qty
              else:
                  quant_cost_qty[quant.cost] = quant.qty
          move_obj = self.pool.get('account.move')
          for cost, qty in quant_cost_qty.items():
              move_lines = self._prepare_account_move_line(cr, uid, move, qty, cost, credit_account_id, debit_account_id, context=context)
              return move_obj.create(cr, uid, {'journal_id': journal_id,
                                        'line_id': move_lines,
                                        'period_id': self.pool.get('account.period').find(cr, uid, move.date, context=context)[0],
                                        'date': move.date,
                                        'ref': move.picking_id and move.picking_id.name}, context=context)

  return breaks the for loop and thus only one quant is reported...

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


Follow ups

References