Comment 2 for bug 1269365

Revision history for this message
开阖软件 Jeff Wang (jeff.osbzr.com) wrote :

Please merge this fix as soon as possible, I face the same problem in my client's production database.

User need 2 steps delivery, so I set the output location as chain mode "manually "

Then when a new sales order been confirmed, 2 picking generated, the first one is a internal picking , then chained to an delivery order.

When user transfer the internal picking, everybody see the product on Output location, but the delivery order keep on waiting.
Click on "Check Availableb" Button returns an error message 'Not enough stock, unable to reserve the products.'

With this patch, chained delivery order can be set as "Ready" right after the internal picking is Done.

I still do not understand why only moves on "confirmed" state is been check,why not check "waiting" state also. (stock/stock.py )

    def action_assign(self, cr, uid, ids, *args):
        """ Changes state of picking to available if all moves are confirmed.
        @return: True
        """
        wf_service = netsvc.LocalService("workflow")
        for pick in self.browse(cr, uid, ids):
            if pick.state == 'draft':
                wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_confirm', cr)
            move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed'] <-------- don't you think we should add "or x.state=='waiting' " ?
            if not move_ids:
                raise osv.except_osv(_('Warning!'),_('Not enough stock, unable to reserve the products.'))
            self.pool.get('stock.move').action_assign(cr, uid, move_ids)
        return True