[FIX][sale_stock]Added validation in get_partner_to_invoice, to only check sale.orders when the picking that call this method coming from a sale.order

This commit is contained in:
luistorresm 2015-04-14 17:20:29 -05:00 committed by Nicolas Martinelli
parent fcc2852a27
commit 01e4b76f65
1 changed files with 6 additions and 5 deletions

View File

@ -445,6 +445,7 @@ class stock_picking(osv.osv):
""" Inherit the original function of the 'stock' module
We select the partner of the sales order as the partner of the customer invoice
"""
if picking.sale_id:
saleorder_ids = self.pool['sale.order'].search(cr, uid, [('procurement_group_id' ,'=', picking.group_id.id)], context=context)
saleorders = self.pool['sale.order'].browse(cr, uid, saleorder_ids, context=context)
if saleorders and saleorders[0] and saleorders[0].order_policy == 'picking':