[IMP] support the case of a wrong picking out

This commit is contained in:
Benoit Guillot
2012-09-27 17:36:12 +02:00
parent f6561b9859
commit 179ca50caa
2 changed files with 19 additions and 0 deletions

View File

@@ -44,3 +44,17 @@ class stock_warehouse(osv.osv):
'lot_breakage_loss_id': fields.many2one('stock.location', 'Location Breakage Loss'),
'lot_refurbish_id': fields.many2one('stock.location', 'Location Refurbish'),
}
#This part concern the case of a wrong picking out. We need to create a new stock_move in a micking already open.
#In order to don't have to confirm the stock_move we override the create and confirm it at the creation only for this case
class stock_move(osv.osv):
_inherit = "stock.move"
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

View File

@@ -24,6 +24,11 @@
<field name="usage">internal</field>
<field name="location_id" ref="stock.stock_location_company"/>
</record>
<record id="stock_location_mistake_loss" model="stock.location">
<field name="name">Misstake Loss</field>
<field name="usage">internal</field>
<field name="location_id" ref="stock.stock_location_company"/>
</record>
<!--
Default Values for : Stock Warehouse
-->