[FIX] stock: chained location type `Customers` was not working at all for pickings...
authorOlivier Dony <odo@openerp.com>
Thu, 7 Nov 2013 10:53:02 +0000 (11:53 +0100)
committerOlivier Dony <odo@openerp.com>
Thu, 7 Nov 2013 10:53:02 +0000 (11:53 +0100)
This can create inconsistencies in the warehouse inventory
in case delivery orders are not customer-specific, e.g.
when using the POS.
When there is no destination customer we can still use
the default Customers locations.

bzr revid: odo@openerp.com-20131107105302-hf8lublc1x3qc87h

addons/stock/stock.py

index 9b222f3..273a9b1 100644 (file)
@@ -241,6 +241,9 @@ class stock_location(osv.osv):
         if location.chained_location_type == 'customer':
             if partner:
                 result = partner.property_stock_customer
+            else:
+                loc_id = self.pool['res.partner'].default_get(cr, uid, ['property_stock_customer'], context=context)['property_stock_customer']
+                result = self.pool['stock.location'].browse(cr, uid, loc_id, context=context)
         elif location.chained_location_type == 'fixed':
             result = location.chained_location_id
         if result: