[WIP] Split of moves
bzr revid: jco@openerp.com-20130829130207-vablfdmy0hfq8ar8
This commit is contained in:
parent
c96c068fbc
commit
48f2171779
|
@ -332,7 +332,7 @@ class stock_quant(osv.osv):
|
||||||
def quants_unreserve(self, cr, uid, move, context=None):
|
def quants_unreserve(self, cr, uid, move, context=None):
|
||||||
#cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
|
#cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
|
||||||
#need write for related store of remaining qty
|
#need write for related store of remaining qty
|
||||||
related_quants = self.search(cr, uid, [('reservation_id', '=', move.id)], context=context)
|
related_quants = [x.id for x in move.reserved_quant_ids]
|
||||||
self.write(cr, uid, related_quants, {'reservation_id': False}, context=context)
|
self.write(cr, uid, related_quants, {'reservation_id': False}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -1442,6 +1442,8 @@ class stock_move(osv.osv):
|
||||||
"""
|
"""
|
||||||
context = context or {}
|
context = context or {}
|
||||||
for move in self.browse(cr, uid, ids, context=context):
|
for move in self.browse(cr, uid, ids, context=context):
|
||||||
|
if move.reserved_quant_ids:
|
||||||
|
self.pool.get("stock.quant").quants_unreserve(cr, uid, move, context=context)
|
||||||
if move.move_dest_id:
|
if move.move_dest_id:
|
||||||
if move.propagate:
|
if move.propagate:
|
||||||
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
|
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
|
||||||
|
@ -1616,10 +1618,9 @@ class stock_move(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def split(self, cr, uid, move, qty, context=None):
|
def split(self, cr, uid, move, qty, context=None):
|
||||||
""" Partially (or not) moves a stock.move.
|
"""
|
||||||
@param partial_datas: Dictionary containing details of partial picking
|
Splits qty from move move into a new move
|
||||||
like partner_id, delivery_date, delivery
|
It will check if it can propagate the split
|
||||||
moves with product_id, product_qty, uom
|
|
||||||
"""
|
"""
|
||||||
if move.product_qty==qty:
|
if move.product_qty==qty:
|
||||||
return move.id
|
return move.id
|
||||||
|
@ -1648,6 +1649,9 @@ class stock_move(osv.osv):
|
||||||
'product_uos_qty': move.product_uos_qty - uos_qty,
|
'product_uos_qty': move.product_uos_qty - uos_qty,
|
||||||
# 'reserved_quant_ids': [(6,0,[])] SHOULD NOT CHANGE as it has been reserved already
|
# 'reserved_quant_ids': [(6,0,[])] SHOULD NOT CHANGE as it has been reserved already
|
||||||
}, context=context)
|
}, context=context)
|
||||||
|
|
||||||
|
if move.move_dest_id and move.propagate:
|
||||||
|
self.split(self, cr, uid, move.move_dest_id, qty, context=context)
|
||||||
return new_move
|
return new_move
|
||||||
|
|
||||||
class stock_inventory(osv.osv):
|
class stock_inventory(osv.osv):
|
||||||
|
@ -1925,7 +1929,7 @@ report_sxw.report_sxw('report.stock.quant.package.barcode', 'stock.quant.package
|
||||||
|
|
||||||
class stock_package(osv.osv):
|
class stock_package(osv.osv):
|
||||||
"""
|
"""
|
||||||
These are the packages, containing quants and/or others packages
|
These are the packages, containing quants and/or other packages
|
||||||
"""
|
"""
|
||||||
_name = "stock.quant.package"
|
_name = "stock.quant.package"
|
||||||
_description = "Physical Packages"
|
_description = "Physical Packages"
|
||||||
|
|
Loading…
Reference in New Issue