[IMP] view of scrap wizard, lot creation in scrap wiz, partial transfer should not do cancelled or done moves

bzr revid: jco@openerp.com-20140114094651-7e7urt3kk0g3jngq
This commit is contained in:
Josse Colpaert 2014-01-14 10:46:51 +01:00
parent 05da75b823
commit e8f469e4c8
2 changed files with 7 additions and 4 deletions

View File

@ -977,7 +977,8 @@ class stock_picking(osv.osv):
def do_recompute_remaining_quantities(self, cr, uid, picking_ids, context=None):
def _create_link_for_product(product_id, qty):
qty_to_assign = qty
for move in picking.move_lines:
active_lines = [x for x in picking.move_lines if x.state not in ['done', 'cancel']]
for move in active_lines:
if move.product_id.id == product_id:
qty_on_link = min(move.remaining_qty, qty_to_assign)
link_obj.create(cr, uid, {'move_id': move.id, 'operation_id': op.id, 'qty': qty_on_link}, context=context)
@ -1060,12 +1061,12 @@ class stock_picking(osv.osv):
if move.remaining_qty == 0:
if move.state in ('draft', 'assigned', 'confirmed'):
todo_move_ids.append(move.id)
elif move.remaining_qty > 0:
elif move.remaining_qty > 0 and move.state not in ['done', 'cancel']:
new_move = stock_move_obj.split(cr, uid, move, move.remaining_qty, context=context)
todo_move_ids.append(move.id)
#Assign move as it was assigned before
toassign_move_ids.append(new_move)
else:
elif move.state not in ['done', 'cancel']:
#this should never happens
raise
self.rereserve_quants(cr, uid, picking, move_ids=todo_move_ids, context=context)

View File

@ -49,7 +49,8 @@
<field name="product_qty" class="oe_inline"/>
<field name="product_uom" class="oe_inline" readonly="1" groups="product.group_uom"/>
</div>
<field name="restrict_lot_id" domain="[('product_id','=',product_id)]" groups="stock.group_tracking_lot"/>
<field name="restrict_lot_id" domain="[('product_id','=',product_id)]" groups="stock.group_tracking_lot"
context="{'product_id': product_id}"/>
<field name="location_id" string="Scrap Location" widget="selection"
domain="[('usage','!=','view'),('scrap_location','=',True)]" groups="stock.group_locations"/>
</group>
@ -66,6 +67,7 @@
<field name="name">Scrap Move</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.move.scrap</field>
<field name="view_id" ref="view_stock_move_scrap_wizard"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>