[Merge] Merge with main addons.
authorDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Wed, 3 Oct 2012 04:42:56 +0000 (10:12 +0530)
committerDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Wed, 3 Oct 2012 04:42:56 +0000 (10:12 +0530)
bzr revid: mdi@tinyerp.com-20121003044256-aw7p8dw64gzbjj08

1  2 
addons/stock/stock.py
addons/stock/stock_view.xml

diff --combined addons/stock/stock.py
@@@ -346,22 -346,28 +346,28 @@@ class stock_location(osv.osv)
          })
          return product_obj.get_product_available(cr, uid, product_ids, context=context)
  
-     def _product_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
+     def _product_get(self, cr, uid, id, product_ids=False, context=None, states=None):
          """
          @param product_ids:
          @param states:
          @return:
          """
+         if states is None:
+             states = ['done']
          ids = id and [id] or []
          return self._product_get_multi_location(cr, uid, ids, product_ids, context=context, states=states)
  
-     def _product_all_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
+     def _product_all_get(self, cr, uid, id, product_ids=False, context=None, states=None):
+         if states is None:
+             states = ['done']
          # build the list of ids of children of the location given by id
          ids = id and [id] or []
          location_ids = self.search(cr, uid, [('location_id', 'child_of', ids)])
          return self._product_get_multi_location(cr, uid, location_ids, product_ids, context, states)
  
-     def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
+     def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=None):
+         if states is None:
+             states = ['done']
          return self._product_all_get(cr, uid, id, product_ids, context, ['confirmed', 'waiting', 'assigned', 'done'])
  
      def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None, lock=False):
@@@ -522,7 -528,7 +528,7 @@@ class stock_tracking(osv.osv)
      def unlink(self, cr, uid, ids, context=None):
          raise osv.except_osv(_('Error!'), _('You cannot remove a lot line.'))
  
-     def action_traceability(self, cr, uid, ids, context={}):
+     def action_traceability(self, cr, uid, ids, context=None):
          """ It traces the information of a product
          @param self: The object pointer.
          @param cr: A database cursor
@@@ -1444,7 -1450,7 +1450,7 @@@ class stock_picking(osv.osv)
                  'internal': _("Products have been <b>moved</b>."),
          }
          for obj in self.browse(cr, uid, ids, context=context):
-             self.message_post(cr, uid, [obj.id], body=type_dict.get(obj.type, _('Products have been moved.')), context=context)
+             self.message_post(cr, uid, [obj.id], body=_("Products have been <b>%s</b>.") % (type_dict.get(obj.type, 'move done')), context=context)
  
      def ship_cancel_send_note(self, cr, uid, ids, context=None):
          for obj in self.browse(cr, uid, ids, context=context):
@@@ -1761,7 -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'
              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)
          @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.
              </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"
                      </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'}"/>
                              <field name="note" placeholder="Add an internal note..." class="oe_inline"/>
                          </page>
                          <page string="Additional Info">
                      </xpath>
                      <xpath expr="/form/sheet" position="after">
                          <div class="oe_chatter">
-                             <field name="message_is_follower" invisible="1"/>
                              <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                              <field name="message_follower_ids" widget="mail_followers"/>
                          </div>
                      </xpath>
                      <xpath expr="/form/sheet" position="after">
                          <div class="oe_chatter">
-                             <field name="message_is_follower" invisible="1"/>
                              <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
                              <field name="message_follower_ids" widget="mail_followers"/>
                          </div>
          <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)