[REF] refactoring made during code review
bzr revid: qdp-launchpad@openerp.com-20140206145741-ee776b9ttcx4r9wb
This commit is contained in:
parent
05ea06a814
commit
dfa126d47a
|
@ -252,10 +252,6 @@ class stock_quant(osv.osv):
|
|||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.quant', context=c),
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
|
||||
''' Overwrite the read_group in order to sum the function field 'inventory_value' in group by'''
|
||||
res = super(stock_quant, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby)
|
||||
|
@ -582,7 +578,6 @@ class stock_quant(osv.osv):
|
|||
return location and (location.usage == 'internal') and location.company_id or False
|
||||
|
||||
def _check_location(self, cr, uid, ids, context=None):
|
||||
pack_obj = self.pool.get("stock.quant.package")
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
if record.location_id.usage == 'view':
|
||||
raise osv.except_osv(_('Error'), _('You cannot move product %s to a location of type view %s.') % (record.product_id.name, record.location_id.name))
|
||||
|
@ -937,8 +932,6 @@ class stock_picking(osv.osv):
|
|||
if move.state not in ('assigned', 'confirmed'):
|
||||
continue
|
||||
|
||||
|
||||
|
||||
#Check which of the reserved quants are entirely in packages (can be in separate method)
|
||||
packages = list(set([x.package_id for x in move.reserved_quant_ids if x.package_id]))
|
||||
done_packages = []
|
||||
|
@ -960,8 +953,6 @@ class stock_picking(osv.osv):
|
|||
done_packages.append(good_pack)
|
||||
done_packages = list(set(done_packages))
|
||||
|
||||
|
||||
|
||||
#Create package operations
|
||||
reserved = set([x.id for x in move.reserved_quant_ids])
|
||||
remaining_qty = move.product_qty
|
||||
|
@ -1004,9 +995,6 @@ class stock_picking(osv.osv):
|
|||
'cost': move.product_id.standard_price,
|
||||
}, context=context)
|
||||
|
||||
#To keep it simple, create pack operations according to negative quants if no pack operations
|
||||
|
||||
|
||||
def do_unreserve(self, cr, uid, picking_ids, context=None):
|
||||
"""
|
||||
Will remove all quants for picking in picking_ids
|
||||
|
@ -1929,8 +1917,9 @@ class stock_move(osv.osv):
|
|||
elif location != quant.location_id.id:
|
||||
raise osv.except_osv(_('Error'), _('You can not put a product in a package that has products in another location. '))
|
||||
|
||||
|
||||
def action_done(self, cr, uid, ids, context=None):
|
||||
""" Process completly the moves given as ids and if all moves are done, it will finish the picking.
|
||||
"""
|
||||
context = context or {}
|
||||
picking_obj = self.pool.get("stock.picking")
|
||||
quant_obj = self.pool.get("stock.quant")
|
||||
|
@ -1953,7 +1942,6 @@ class stock_move(osv.osv):
|
|||
operations = list(operations)
|
||||
operations.sort(key = lambda x: ((x.package_id and not x.product_id) and -4 or 0) + (x.package_id and -2 or 0) + (x.lot_id and -1 or 0))
|
||||
|
||||
|
||||
for ops in operations:
|
||||
if ops.picking_id:
|
||||
pickings.add(ops.picking_id.id)
|
||||
|
@ -1962,7 +1950,7 @@ class stock_move(osv.osv):
|
|||
move = record.move_id
|
||||
prefered_domain = [('reservation_id', '=', move.id)]
|
||||
fallback_domain = [('reservation_id', '=', False)]
|
||||
self.check_tracking(cr, uid, move, ops.lot_id.id, context=context)
|
||||
self.check_tracking(cr, uid, move, ops.package_id.id or ops.lot_id.id, context=context)
|
||||
dom = main_domain + self.pool.get('stock.move.operation.link').get_specific_domain(cr, uid, record, context=context)
|
||||
quants = quant_obj.quants_get_prefered_domain(cr, uid, move.location_id, move.product_id, record.qty, domain=dom, prefered_domain=prefered_domain,
|
||||
fallback_domain=fallback_domain, restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context)
|
||||
|
@ -2012,7 +2000,6 @@ class stock_move(osv.osv):
|
|||
picking_obj.write(cr, uid, done_picking, {'date_done': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -3271,7 +3258,6 @@ class stock_package(osv.osv):
|
|||
'name': lambda self, cr, uid, context: self.pool.get('ir.sequence').get(cr, uid, 'stock.quant.package') or _('Unknown Pack')
|
||||
}
|
||||
|
||||
|
||||
def action_print(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
|
Loading…
Reference in New Issue