[FIX]mrp: in MO consuming product not taking Exiting Lot

lp bug: https://launchpad.net/bugs/691012 fixed

bzr revid: ron@tinyerp.com-20101221071238-3zyspxlqmow7nmh0
This commit is contained in:
ron@tinyerp.com
2010-12-21 12:42:38 +05:30
parent dfd44bd10e
commit bcdfc08fb7
2 changed files with 8 additions and 10 deletions
+6 -6
View File
@@ -600,8 +600,13 @@
<field name="state" invisible="1"/>
<button name="%(stock.move_consume)d"
string="Consume Products" type="action"
icon="gtk-go-forward" context="{'consume': True}"
icon="gtk-go-forward" context="{'consume': True,'prodlot_id':prodlot_id}"
states="draft,waiting,confirmed,assigned" />
<button
name="%(stock.track_line)d"
string="Split in production lots"
type="action" icon="gtk-justify-fill"
states="raft,waiting,confirmed,assigned" />
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
@@ -619,11 +624,6 @@
<field name="prodlot_id" context="{'product_id': product_id}"/>
<field name="state" invisible="1"/>
<field name="scrapped" invisible="1"/>
<button
name="%(stock.track_line)d"
string="Split in production lots"
type="action" icon="gtk-justify-fill"
states="done,cancel" />
<button
name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
+2 -4
View File
@@ -2262,12 +2262,10 @@ class stock_move(osv.osv):
context = {}
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
res = []
for move in self.browse(cr, uid, ids, context=context):
move_qty = move.product_qty
quantity_rest = move.product_qty
quantity_rest -= quantity
uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
if quantity_rest <= 0:
@@ -2284,7 +2282,7 @@ class stock_move(osv.osv):
'state': move.state,
'location_id': location_id or move.location_id.id,
}
if move.product_id.track_production and location_id:
if (not move.prodlot_id.id) and (move.product_id.track_production and location_id):
# IF product has checked track for production lot, move lines will be split by 1
res += self.action_split(cr, uid, [move.id], quantity, split_by_qty=1, context=context)
else:
@@ -2298,7 +2296,7 @@ class stock_move(osv.osv):
else:
quantity_rest = quantity
uos_qty_rest = uos_qty
if move.product_id.track_production and location_id:
if (not move.prodlot_id.id) and (move.product_id.track_production and location_id):
res += self.action_split(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
else:
res += [move.id]