[FIX] mrp: Manufacturing Order Consumes too many products when they are split. : (Maintenance Case : 579232)

bzr revid: rgo@tinyerp.com-20121004131613-f9cosqejhdt0zhr7
This commit is contained in:
Ravi Gohil (Open ERP)
2012-10-04 18:46:13 +05:30
parent faaf115ed8
commit 5545d57023
3 changed files with 20 additions and 2 deletions
+14 -1
View File
@@ -737,8 +737,21 @@ class mrp_production(osv.osv):
# we already have more qtys consumed than we need
continue
qty_remained = 0
qty_tobe_consumed = qty
for consume_line in raw_product:
consume_line.action_consume(qty, consume_line.location_id.id, context=context)
if consume_line.prodlot_id and consume_line.product_id.id==scheduled.product_id.id:
if qty_remained:
qty = qty_remained
if consume_line.product_qty >= qty:
consume_line.action_consume(qty, consume_line.location_id.id, context=context)
break
else:
qty_tobe_consumed += consume_line.product_qty
consume_line.action_consume(qty_tobe_consumed, consume_line.location_id.id, context=context)
qty_remained = qty - consume_line.product_qty
else:
consume_line.action_consume(qty, consume_line.location_id.id, context=context)
if production_mode == 'consume_produce':
# To produce remaining qty of final product
+5
View File
@@ -661,6 +661,7 @@
<field name="product_qty" string="Qty"/>
<field name="product_uom" string="UOM"/>
<field name="location_id" string="Source Loc."/>
<field name="prodlot_id" string="Production Lot"/>
<field name="state" invisible="1"/>
<button name="%(stock.move_consume)d"
string="Consume Products" type="action"
@@ -687,6 +688,10 @@
<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"/>
<button
name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
+1 -1
View File
@@ -1585,7 +1585,7 @@ class stock_move(osv.osv):
'location_dest_id': fields.many2one('stock.location', 'Destination Location', required=True,states={'done': [('readonly', True)]}, select=True, help="Location where the system will stock the finished products."),
'address_id': fields.many2one('res.partner.address', 'Destination Address ', states={'done': [('readonly', True)]}, help="Optional address where goods are to be delivered, specifically used for allotment"),
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', states={'done': [('readonly', True)]}, help="Production lot is used to put a serial number on the production", select=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', help="Production lot is used to put a serial number on the production", select=True),
'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, states={'done': [('readonly', True)]}, help="Logistical shipping unit: pallet, box, pack ..."),
'auto_validate': fields.boolean('Auto Validate'),