[IMP] Check get stock move matchings
bzr revid: jco@openerp.com-20130527162317-oc8fwx2jw0q7evfo
This commit is contained in:
@@ -329,7 +329,7 @@
|
||||
line = self.browse(cr, uid, partial_id, context=context).move_ids[0]
|
||||
self.pool.get("stock.partial.picking.line").write(cr, uid, [line.id], {'quantity':50})
|
||||
self.do_partial(cr, uid, [partial_id])
|
||||
from datetime import *
|
||||
from datetime import datetime.now(), timedelta
|
||||
picking_id = self.pool.get("stock.picking").browse(cr, uid, ref("outgoing_fifo_shipment_neg2")).backorder_id.id
|
||||
mov_ids = self.pool.get("stock.move").search(cr, uid, [('picking_id', '=', picking_id)])
|
||||
self.pool.get("stock.move").write(cr, uid, mov_ids, {'date': (datetime.now()+timedelta(seconds=3)).strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
@@ -90,13 +90,16 @@ class product_product (osv.osv):
|
||||
if not currency_id:
|
||||
currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id
|
||||
if fifo:
|
||||
move_in_ids = move_obj.search(cr, uid, [('company_id','=', company_id), ('qty_remaining', '>', 0), ('state', '=', 'done'),
|
||||
('location_id.usage', '!=', 'internal'), ('location_dest_id.usage', '=', 'internal'), ('product_id', '=', product.id)],
|
||||
order = 'date', context=context)
|
||||
order = 'date, id'
|
||||
else:
|
||||
move_in_ids = move_obj.search(cr, uid, [('company_id','=', company_id), ('qty_remaining', '>', 0), ('state', '=', 'done'),
|
||||
('location_id.usage', '!=', 'internal'), ('location_dest_id.usage', '=', 'internal'), ('product_id', '=', product.id)],
|
||||
order = 'date desc', context=context)
|
||||
order = 'date desc, id'
|
||||
move_in_ids = move_obj.search(cr, uid, [('company_id','=', company_id),
|
||||
('qty_remaining', '>', 0),
|
||||
('state', '=', 'done'),
|
||||
('location_id.usage', '!=', 'internal'),
|
||||
('location_dest_id.usage', '=', 'internal'),
|
||||
('product_id', '=', product.id)],
|
||||
order = order, context=context)
|
||||
tuples = []
|
||||
qty_to_go = qty
|
||||
for move in move_obj.browse(cr, uid, move_in_ids, context=context):
|
||||
@@ -117,6 +120,8 @@ class product_product (osv.osv):
|
||||
else:
|
||||
tuples.append((move.id, qty_to_go, new_price, qty_from * qty_to_go / product_qty),)
|
||||
break
|
||||
if tuples == [] and move_in_ids != []:
|
||||
raise osv.except_osv(_('Error'), 'Not possible that there are no tuples when move ins')
|
||||
return tuples
|
||||
|
||||
class stock_move(osv.osv):
|
||||
|
||||
Reference in New Issue
Block a user