[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):
|
||||
#cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
|
||||
#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)
|
||||
return True
|
||||
|
||||
|
@ -1442,6 +1442,8 @@ class stock_move(osv.osv):
|
|||
"""
|
||||
context = context or {}
|
||||
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.propagate:
|
||||
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
|
||||
|
@ -1616,10 +1618,9 @@ class stock_move(osv.osv):
|
|||
return res
|
||||
|
||||
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
|
||||
like partner_id, delivery_date, delivery
|
||||
moves with product_id, product_qty, uom
|
||||
"""
|
||||
Splits qty from move move into a new move
|
||||
It will check if it can propagate the split
|
||||
"""
|
||||
if move.product_qty==qty:
|
||||
return move.id
|
||||
|
@ -1648,6 +1649,9 @@ class stock_move(osv.osv):
|
|||
'product_uos_qty': move.product_uos_qty - uos_qty,
|
||||
# 'reserved_quant_ids': [(6,0,[])] SHOULD NOT CHANGE as it has been reserved already
|
||||
}, 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
|
||||
|
||||
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):
|
||||
"""
|
||||
These are the packages, containing quants and/or others packages
|
||||
These are the packages, containing quants and/or other packages
|
||||
"""
|
||||
_name = "stock.quant.package"
|
||||
_description = "Physical Packages"
|
||||
|
|
Loading…
Reference in New Issue