Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons_12_warehouse-mdi into 
lp:openobject-addons.

Requested reviews:
  Purnendu Singh (OpenERP) (psi-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_12_warehouse-mdi/+merge/126439
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_12_warehouse-mdi/+merge/126439
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons_12_warehouse-mdi.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-09-26 08:16:13 +0000
+++ stock/stock.py	2012-09-27 12:31:37 +0000
@@ -1724,7 +1724,7 @@
             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'
@@ -1755,7 +1755,7 @@
             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)
@@ -1943,25 +1943,17 @@
         @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.

=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml	2012-09-26 07:41:21 +0000
+++ stock/stock_view.xml	2012-09-27 12:31:37 +0000
@@ -272,7 +272,7 @@
             </field>
         </record>
         <menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root" 
-            sequence="3" groups="stock.group_tracking_lot,stock.group_production_lot"/>
+            sequence="3"/>
         <menuitem action="action_tracking_form" id="menu_action_tracking_form"
             groups="product.group_stock_packaging"
             sequence="6"
@@ -778,7 +778,7 @@
                     </group>
                     <notebook>
                         <page string="Products">
-                            <field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}"/>
+                            <field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'picking_type': 'internal'}"/>
                         </page>
                         <page string="Additional Info">
                             <group>
@@ -1419,7 +1419,7 @@
         <field name="act_window_id" ref="action_move_form2"/>
         </record>
 
-        <menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="3"/>
+        <menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="3" groups="stock.group_locations"/>
 
         <!--
             Reception Picking (By Stock Move)

=== modified file 'stock/wizard/stock_return_picking.py'
--- stock/wizard/stock_return_picking.py	2012-09-26 07:41:21 +0000
+++ stock/wizard/stock_return_picking.py	2012-09-27 12:31:37 +0000
@@ -72,7 +72,7 @@
                     res.update({'invoice_state': 'none'})
             return_history = self.get_return_history(cr, uid, record_id, context)       
             for line in pick.move_lines:
-                qty = line.product_qty - return_history[line.id]
+                qty = line.product_qty - return_history.get(line.id, 0)
                 if qty > 0:
                     result1.append({'product_id': line.product_id.id, 'quantity': qty,'move_id':line.id})
             if 'product_return_moves' in fields:
@@ -100,8 +100,8 @@
             valid_lines = 0
             return_history = self.get_return_history(cr, uid, record_id, context)
             for m  in pick.move_lines:
-                if m.product_qty * m.product_uom.factor > return_history[m.id]:
-                        valid_lines += 1
+                if m.state == 'done' and m.product_qty * m.product_uom.factor > return_history.get(m.id, 0):
+                    valid_lines += 1
             if not valid_lines:
                 raise osv.except_osv(_('Warning!'), _("No products to return (only lines in Done state and not fully returned yet can be returned)!"))
         return res

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to