[MERGE]Merge with lp:~openerp-dev/openobject-addons/trunk-stock_picking_usability
authorMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Wed, 28 Mar 2012 11:36:00 +0000 (17:06 +0530)
committerMayur Maheshwari (OpenERP) <mma@tinyerp.com>
Wed, 28 Mar 2012 11:36:00 +0000 (17:06 +0530)
bzr revid: mma@tinyerp.com-20120328113600-jnkuqxkvqbgsg1d9

addons/stock/stock.py
addons/stock/stock_view.xml
addons/stock/wizard/stock_partial_picking.py

index 8473c31..065a832 100644 (file)
@@ -710,26 +710,18 @@ class stock_picking(osv.osv):
             for field in res['fields']:
                 # To update the states label according to shipping type
                 if field == 'state':
-                    _state = []
-                    for key, value in PICK_STATE:
-                        if type == 'in':
-                            if key == 'assigned':
-                                value = _('Ready to Receive')
-                            elif key == 'done':
-                                value = _('Received')
-                        elif type == 'internal':
-                            if key == 'assigned':
-                                value = _('Ready to Transfer')
-                            elif key == 'done':
-                                value = _('Transferred')
-                        elif type == 'out':
-                            if key == 'assigned':
-                                value = _('Ready to Deliver')
-                            elif key == 'done':
-                                value = _('Delivered')
-                        _state.append((key,value))
-                    res['fields']['state']['selection'] = _state
-                    res['fields']['state']['help'] = self._tooltip_picking_state(dict(_state))
+                    _state = dict(PICK_STATE)
+                    if type == 'in':
+                        _state['assigned'] = _('Ready to Receive')
+                        _state['done'] = _('Received')
+                    elif type == 'internal':
+                        _state['assigned'] = _('Ready to Transfer')
+                        _state['done'] = _('Transferred')
+                    elif type == 'out':
+                        _state['assigned'] = _('Ready to Deliver')
+                        _state['done'] = _('Delivered')
+                    res['fields']['state']['selection'] = [(x[0], _state[x[0]]) for x in PICK_STATE]
+                    res['fields']['state']['help'] = self._tooltip_picking_state(_state)
                 # To update the fields tooltips according to shipping type
                 if field == 'address_id':
                     _tooltip = ''
@@ -898,6 +890,8 @@ class stock_picking(osv.osv):
         #TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state
         ok = True
         for pick in self.browse(cr, uid, ids):
+            if pick.type == 'in':
+                return True
             mt = pick.move_type
             for move in pick.move_lines:
                 if (move.state in ('confirmed', 'draft')) and (mt == 'one'):
@@ -1736,28 +1730,20 @@ class stock_move(osv.osv):
                 for node in doc.xpath("//group/button[@string='Process Now']"):
                     node.set('string', _('Deliver'))
             for field in res['fields']:
-#                # To update the states label according to the containing shipping type
+                # To update the states label according to shipping type
                 if field == 'state':
-                    _state = []
-                    for key, value in MOVE_STATE:
-                        if type == 'in':
-                            if key == 'assigned':
-                                value = _('Ready to Receive')
-                            elif key == 'done':
-                                value = _('Received')
-                        elif type == 'internal':
-                            if key == 'assigned':
-                                value = _('Ready to Transfer')
-                            elif key == 'done':
-                                value = _('Transferred')
-                        elif type == 'out':
-                            if key == 'assigned':
-                                value = _('Ready to Deliver')
-                            elif key == 'done':
-                                value = _('Delivered')
-                        _state.append((key,value))
-                    res['fields']['state']['selection'] = _state
-                    res['fields']['state']['help'] = self._tooltip_move_state(dict(_state))
+                    _state = dict(MOVE_STATE)
+                    if type == 'in':
+                        _state['assigned'] = _('Ready to Receive')
+                        _state['done'] = _('Received')
+                    elif type == 'internal':
+                        _state['assigned'] = _('Ready to Transfer')
+                        _state['done'] = _('Transferred')
+                    elif type == 'out':
+                        _state['assigned'] = _('Ready to Deliver')
+                        _state['done'] = _('Delivered')
+                    res['fields']['state']['selection'] = [(x[0], _state[x[0]]) for x in MOVE_STATE]
+                    res['fields']['state']['help'] = self._tooltip_move_state(_state)
                     res['arch'] = etree.tostring(doc)
         return res
 
index 03d525e..23da127 100644 (file)
                                 </form>
                             </field>
                             <group col="10" colspan="4">
-                                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
+                                <field name="state" readonly="1" widget="statusbar" statusbar_visible="draft,assigned,done" statusbar_colors='{"auto":"blue", "confirmed":"blue"}'/>
                                 <button name="draft_force_assign" states="draft" string="Confirm" type="object" icon="gtk-ok"/>
                                 <button name="draft_validate" states="draft" string="Confirm &amp; Receive" type="object" icon="gtk-media-play"/>
                                 <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
index 8a25625..d3e5096 100644 (file)
@@ -138,7 +138,7 @@ class stock_partial_picking(osv.osv_memory):
     def _partial_move_for(self, cr, uid, move):
         partial_move = {
             'product_id' : move.product_id.id,
-            'quantity' : move.state in ('assigned','new') and move.product_qty or 0,
+            'quantity' : move.state in ('assigned','draft','confirmed') and move.product_qty or 0,
             'product_uom' : move.product_uom.id,
             'prodlot_id' : move.prodlot_id.id,
             'move_id' : move.id,