# 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
<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"
<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"
icon="gtk-convert"
'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'),