[IMP] delivery,project_mrp,sale_journal: use the new extensible API of sale/purchase picking creation

This also updates the code to use the new API with
the conventional context passing

bzr revid: odo@openerp.com-20111221151639-q9nnxurg9v4vvtnr
This commit is contained in:
Olivier Dony 2011-12-21 16:16:39 +01:00
parent 04be08d0f0
commit 48eaf61c01
3 changed files with 11 additions and 17 deletions

View File

@ -36,14 +36,12 @@ class sale_order(osv.osv):
result['value']['carrier_id'] = dtype
return result
def action_ship_create(self, cr, uid, ids, *args):
result = super(sale_order, self).action_ship_create(cr, uid, ids, *args)
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in order.picking_ids]
self.pool.get('stock.picking').write(cr, uid, pids, {
'carrier_id':order.carrier_id.id,
})
def _prepare_order_picking(self, cr, uid, order, context=None):
result = super(sale_order, self)._prepare_order_picking(cr, uid, order, context=context)
result.update(carrier_id=order.carrier_id.id)
return result
sale_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -57,9 +57,9 @@ product_product()
class sale_order(osv.osv):
_inherit ='sale.order'
def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, *args):
def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
proc_data = super(sale_order, self)._prepare_order_line_procurement(cr,
uid, order, line, move_id, date_planned, *args)
uid, order, line, move_id, date_planned, context=context)
proc_data['sale_line_id'] = line.id
return proc_data

View File

@ -66,14 +66,10 @@ class sale(osv.osv):
_columns = {
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
}
def action_ship_create(self, cr, uid, ids, *args):
result = super(sale, self).action_ship_create(cr, uid, ids, *args)
obj_stock_pick = self.pool.get('stock.picking')
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in order.picking_ids]
self.pool.get('stock.picking').write(cr, uid, pids, {
'invoice_type_id': order.invoice_type_id and order.invoice_type_id.id or False,
})
def _prepare_order_picking(self, cr, uid, order, context=None):
result = super(sale,self)._prepare_order_picking(cr, uid, order, context=context)
result.update(invoice_type_id=order.invoice_type_id and order.invoice_type_id.id or False)
return result
def onchange_partner_id(self, cr, uid, ids, part):