[REF] mrp_repair, stock: small code refactoring

bzr revid: qdp-launchpad@tinyerp.com-20110117100122-gson7kged6atppnb
This commit is contained in:
qdp-launchpad@tinyerp.com 2011-01-17 11:01:22 +01:00
parent f2784aecc5
commit f28ed00264
3 changed files with 13 additions and 13 deletions

View File

@ -330,7 +330,7 @@ class mrp_repair(osv.osv):
for line in o.operations:
if line.product_id.track_production and not line.prodlot_id:
raise osv.except_osv(_('Warning'), _("Production lot is required for opration line with product '%s'") % (line.product_id.name))
mrp_line_obj.write(cr, uid, [line.id], {'state': 'confirmed'})
mrp_line_obj.write(cr, uid, [l.id for l in o.operations], {'state': 'confirmed'})
return True
def action_cancel(self, cr, uid, ids, context=None):

View File

@ -2582,6 +2582,15 @@ class stock_inventory(osv.osv):
self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]})
return True
def action_cancel_draft(self, cr, uid, ids, context=None):
""" Cancels the stock move and change inventory state to draft.
@return: True
"""
for inv in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context=context)
self.write(cr, uid, [inv.id], {'state':'draft'}, context=context)
return True
def action_cancel_inventary(self, cr, uid, ids, context=None):
""" Cancels both stock move and inventory
@return: True
@ -2602,15 +2611,6 @@ class stock_inventory(osv.osv):
self.write(cr, uid, [inv.id], {'state': 'cancel'}, context=context)
return True
def action_cancel_draft(self, cr, uid, ids, context=None):
""" Cancels the stock move and change inventory state to draft.
@return: True
"""
for inv in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context=context)
self.write(cr, uid, [inv.id], {'state':'draft'}, context=context)
return True
stock_inventory()
class stock_inventory_line(osv.osv):

View File

@ -28,9 +28,9 @@ class stock_partial_picking(osv.osv_memory):
_name = "stock.partial.picking"
_description = "Partial Picking"
_columns = {
'date': fields.datetime('Date', required=True),
'product_moves_out' : fields.one2many('stock.move.memory.out', 'wizard_id', 'Moves'),
'product_moves_in' : fields.one2many('stock.move.memory.in', 'wizard_id', 'Moves'),
'date': fields.datetime('Date', required=True),
'product_moves_out' : fields.one2many('stock.move.memory.out', 'wizard_id', 'Moves'),
'product_moves_in' : fields.one2many('stock.move.memory.in', 'wizard_id', 'Moves'),
}
def get_picking_type(self, cr, uid, picking, context=None):