summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorluistorresm <luis_t@vauxoo.com>2015-04-14 17:20:29 -0500
committerNicolas Martinelli <nim@odoo.com>2015-07-01 08:26:06 +0200
commit01e4b76f656df1ef88b57af511ea28f3e9b6dc1d (patch)
tree70723c5ec6a0bc345aad794d8703af7b36ef40b1 /addons
parentfcc2852a27998d4d566b6ede33fe71686ea0a4e9 (diff)
[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
Diffstat (limited to 'addons')
-rw-r--r--addons/sale_stock/sale_stock.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 48f11ed316e..4cca4aeda79 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -445,11 +445,12 @@ 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
"""
- 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':
- saleorder = saleorders[0]
- return saleorder.partner_invoice_id.id
+ 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':
+ saleorder = saleorders[0]
+ return saleorder.partner_invoice_id.id
return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)
def _get_sale_id(self, cr, uid, ids, name, args, context=None):