[IMP] Action assign button on production order + quant_ids readonly on serial number

bzr revid: jco@openerp.com-20140422085831-yt7hdb3catb5w00q
This commit is contained in:
Josse Colpaert 2014-04-22 10:58:31 +02:00
parent 2b2b360fde
commit a7d4e518ae
3 changed files with 11 additions and 1 deletions

View File

@ -1069,6 +1069,15 @@ class mrp_production(osv.osv):
production.write({'state': 'confirmed'}, context=context)
return 0
def action_assign(self, cr, uid, ids, context=None):
"""
Checks the availability on the consume lines of the production order
"""
move_obj = self.pool.get("stock.move")
for production in self.browse(cr, uid, ids, context=context):
move_obj.action_assign(cr, uid, [x.id for x in production.move_lines], context=context)
def force_production(self, cr, uid, ids, *args):
""" Assigns products.
@param *args: Arguments

View File

@ -673,6 +673,7 @@
<header>
<button name="button_confirm" states="draft" string="Confirm Production" class="oe_highlight"/>
<button name="%(act_mrp_product_produce)d" states="ready,in_production" string="Produce" type="action" class="oe_highlight"/>
<button name="action_assign" states="confirmed,picking_except" string="Check Availability" type="object" class="oe_highlight"/>
<button name="force_production" states="confirmed" string="Force Reservation" type="object"/>
<button name="force_production" states="picking_except" string="Force Reservation" type="object"/>
<button name="button_produce" states="ready" string="Mark as Started"/>

View File

@ -1412,7 +1412,7 @@ class stock_production_lot(osv.osv):
'name': fields.char('Serial Number', size=64, required=True, help="Unique Serial Number"),
'ref': fields.char('Internal Reference', size=256, help="Internal reference number in case it differs from the manufacturer's serial number"),
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '<>', 'service')]),
'quant_ids': fields.one2many('stock.quant', 'lot_id', 'Quants'),
'quant_ids': fields.one2many('stock.quant', 'lot_id', 'Quants', readonly=True),
'create_date': fields.datetime('Creation Date'),
}
_defaults = {