Activity log for bug #1302625

Date Who What changed Old value New value Message
2014-04-04 14:14:43 Daivaras bug added bug
2014-04-04 14:44:17 Daivaras affects openobject-addons openerp-trunk-wms
2014-04-04 14:56:40 Daivaras 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... stock_account.py: return breaks the for loop and thus only one quant is reported in the accounting... i.e. remove the word "return" here and everything works perfectly. 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)
2014-04-04 14:56:55 Daivaras description stock_account.py: return breaks the for loop and thus only one quant is reported in the accounting... i.e. remove the word "return" here and everything works perfectly. 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) stock_account.py: "return" breaks the for loop and thus only one quant is reported in the accounting... i.e. remove the word "return" here and everything works perfectly. 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)
2014-04-04 14:58:21 Daivaras description stock_account.py: "return" breaks the for loop and thus only one quant is reported in the accounting... i.e. remove the word "return" here and everything works perfectly. 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) stock_account.py: "return" breaks the for loop and thus only one quant is reported in the accounting... solution: remove the word "return" here and everything works perfectly. 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)
2014-04-04 15:12:28 Daivaras description stock_account.py: "return" breaks the for loop and thus only one quant is reported in the accounting... solution: remove the word "return" here and everything works perfectly. 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) stock_account.py: "return" breaks the for loop and thus only one quant is reported in the accounting... solution: remove the word "return". Or even better would be to sum them up (total+=qty*cost) and then create accounting entry, this way we would avoid multiple valuation entries. original function: 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)
2014-04-04 15:47:57 Daivaras summary Skipping quants in _account_move_line Skipping quants in _create_account_move_line
2014-04-05 16:36:09 Josse Colpaert (OpenERP) openerp-trunk-wms: status New Confirmed
2014-04-10 14:33:56 Launchpad Janitor branch linked lp:~openerp-dev/openobject-addons/trunk-wms
2014-04-10 14:34:36 qdp (OpenERP) openerp-trunk-wms: status Confirmed Fix Released
2014-04-10 20:04:01 hbto [Vauxoo] http://www.vauxoo.com attachment added stock_account.stock_account.py.patch2 https://bugs.launchpad.net/openerp-trunk-wms/+bug/1302625/+attachment/4080098/+files/stock_account.stock_account.py.patch2
2014-04-11 10:12:36 hbto [Vauxoo] http://www.vauxoo.com bug added subscriber hbto [Vauxoo] http://www.vauxoo.com