[IMP] Picking of purchase order should have its picking type.
bzr revid: jco@openerp.com-20130919095757-ng16zkboiz0y5fh8
This commit is contained in:
parent
82f8702c9a
commit
01c98d49e5
|
@ -667,10 +667,8 @@ class purchase_order(osv.osv):
|
|||
return user_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
|
||||
def _prepare_order_picking(self, cr, uid, order, context=None):
|
||||
type_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'picking_type_in')[1]
|
||||
type = self.pool.get("stock.picking.type").browse(cr, uid, type_id, context=context)
|
||||
return {
|
||||
'name': self.pool.get('ir.sequence').get_id(cr, uid, type.sequence_id.id, 'id'),
|
||||
'name': self.pool.get('ir.sequence').get_id(cr, uid, order.picking_type_id.sequence_id.id, 'id'),
|
||||
'origin': order.name + ((order.origin and (':' + order.origin)) or ''),
|
||||
'date': self.date_to_datetime(cr, uid, order.date_order, context),
|
||||
'partner_id': order.dest_address_id.id or order.partner_id.id,
|
||||
|
@ -679,12 +677,11 @@ class purchase_order(osv.osv):
|
|||
'purchase_id': order.id,
|
||||
'company_id': order.company_id.id,
|
||||
'move_lines' : [],
|
||||
'picking_type_id': type_id,
|
||||
'picking_type_id': order.picking_type_id.id,
|
||||
}
|
||||
|
||||
def _prepare_order_line_move(self, cr, uid, order, order_line, picking_id, group_id, context=None):
|
||||
''' prepare the stock move data from the PO line '''
|
||||
type_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'picking_type_in')[1]
|
||||
price_unit = order_line.price_unit
|
||||
if order_line.product_uom.id != order_line.product_id.uom_id.id:
|
||||
price_unit *= order_line.product_uom.factor
|
||||
|
@ -709,7 +706,7 @@ class purchase_order(osv.osv):
|
|||
'purchase_line_id': order_line.id,
|
||||
'company_id': order.company_id.id,
|
||||
'price_unit': price_unit,
|
||||
'picking_type_id': type_id,
|
||||
'picking_type_id': order.picking_type_id.id,
|
||||
'group_id': group_id,
|
||||
}
|
||||
|
||||
|
|
|
@ -831,7 +831,7 @@ class stock_picking(osv.osv):
|
|||
#Find moves that correspond
|
||||
if ops.product_id:
|
||||
#TODO: Should have order such that things with lots and packings are searched first
|
||||
move_ids = move_obj.search(cr, uid, [('picking_id','=',picking.id), ('product_id', '=', ops.product_id.id), ('remaining_qty', '>', 0.0), ('state', '=', ['assigned'])], context=context)
|
||||
move_ids = move_obj.search(cr, uid, [('picking_id','=',picking.id), ('product_id', '=', ops.product_id.id), ('remaining_qty', '>', 0.0), ('state', '=', 'assigned')], context=context)
|
||||
qty_to_do = ops.product_qty
|
||||
while qty_to_do > 0 and move_ids:
|
||||
move = move_obj.browse(cr, uid, move_ids.pop(), context=context)
|
||||
|
|
|
@ -148,8 +148,6 @@
|
|||
backorder = self.search(cr, uid, [('backorder_id.id', '=', picking.id)], context=context)
|
||||
assert backorder, "Backorder should have been created"
|
||||
backorder_id = self.browse(cr, uid, backorder, context=context)
|
||||
self.action_confirm(cr, uid, backorder, context=context)
|
||||
self.action_assign(cr, uid, backorder)
|
||||
self.do_prepare_partial(cr, uid, backorder, context=context)
|
||||
stock_pack = self.pool.get('stock.pack.operation').create(cr, uid, {'picking_id': backorder_id[0].id, 'product_qty': 20})
|
||||
-
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
-
|
||||
!context
|
||||
noupdate: 1
|
||||
-
|
||||
Create Two Customers
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue