diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 91e300eaa07..765599aa842 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1767,7 +1767,7 @@ class stock_move(osv.osv): location_id = property_out and property_out.id or False else: location_xml_id = False - if picking_type == 'in': + if picking_type in ('in', 'internal'): location_xml_id = 'stock_location_stock' elif picking_type == 'out': location_xml_id = 'stock_location_customers' @@ -1798,7 +1798,7 @@ class stock_move(osv.osv): location_xml_id = False if picking_type == 'in': location_xml_id = 'stock_location_suppliers' - elif picking_type == 'out': + elif picking_type in ('out', 'internal'): location_xml_id = 'stock_location_stock' if location_xml_id: location_model, location_id = mod_obj.get_object_reference(cr, uid, 'stock', location_xml_id) @@ -2011,25 +2011,17 @@ class stock_move(osv.osv): @return: Dictionary of values """ mod_obj = self.pool.get('ir.model.data') - location_source_id = False - location_dest_id = False + location_source_id = 'stock_location_stock' + location_dest_id = 'stock_location_stock' if type == 'in': location_source_id = 'stock_location_suppliers' location_dest_id = 'stock_location_stock' elif type == 'out': location_source_id = 'stock_location_stock' location_dest_id = 'stock_location_customers' - if location_source_id: - try: - location_model, location_source_id = mod_obj.get_object_reference(cr, uid, 'stock', location_source_id) - except ValueError, e: - location_source_id = False - if location_dest_id: - try: - location_model, location_dest_id = mod_obj.get_object_reference(cr, uid, 'stock', location_dest_id) - except ValueError, e: - location_dest_id = False - return {'value':{'location_id': location_source_id, 'location_dest_id': location_dest_id}} + source_location = mod_obj.get_object_reference(cr, uid, 'stock', location_source_id) + dest_location = mod_obj.get_object_reference(cr, uid, 'stock', location_dest_id) + return {'value':{'location_id': source_location and source_location[1] or False, 'location_dest_id': dest_location and dest_location[1] or False}} def onchange_date(self, cr, uid, ids, date, date_expected, context=None): """ On change of Scheduled Date gives a Move date. diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 1a3f8e57d5c..329425148c5 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -777,7 +777,7 @@ - + @@ -1416,7 +1416,7 @@ - +