Error when update stock of a product

Bug #1076448 reported by Pollet Alexandre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP RMA
New
Undecided
Unassigned

Bug Description

Hello,

On the product form, if you update the stock (Update button next to qty_available) you have this error:

picking = self.pool.get('stock.picking').browse(cr, uid, vals['picking_id'], context=context)
KeyError: 'picking_id'

The code in crm_claim_rma/stock.py is:

def create(self, cr, uid, vals, context=None):
        move_id = super(stock_move, self).create(cr, uid, vals, context=context)
        picking = self.pool.get('stock.picking').browse(cr, uid, vals['picking_id'], context=context)
        if picking.claim_picking and picking.type == u'in':
            move = self.write(cr, uid, move_id, {'state': 'confirmed'}, context=context)
        return move_id

If you do an Inventory, there is no picking_id in vals !

So I have patched with this code:

    def create(self, cr, uid, vals, context=None):
        move_id = super(stock_move, self).create(cr, uid, vals, context=context)
        if vals.get('picking_id',False):
            picking = self.pool.get('stock.picking').browse(cr, uid, vals['picking_id'], context=context)
            if picking.claim_picking and picking.type == u'in':
                move = self.write(cr, uid, move_id, {'state': 'confirmed'}, context=context)
        return move_id

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.