From 05ca984c3efb5ddd5ac27297e65f248bd7a2b3a1 Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Wed, 28 Mar 2012 12:56:55 +0530 Subject: [PATCH 1/3] [IMP] stock: improve the logic of fields_view_get metthod bzr revid: psi@tinyerp.com-20120328072655-2k4c27dh0u5wsaod --- addons/stock/stock.py | 66 ++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8473c31a103..a25e2503ba0 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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 = '' @@ -1736,28 +1728,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 From 7b4d697213f76f7da3644ff49157a5bc3b5c88ac Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Wed, 28 Mar 2012 16:28:31 +0530 Subject: [PATCH 2/3] [IMP] stock: in case of reception hide the waiting avaibility state and flow goes to direct from draft to ready to receive bzr revid: psi@tinyerp.com-20120328105831-4dbllz7rm0klpvdj --- addons/stock/stock.py | 2 ++ addons/stock/stock_view.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index a25e2503ba0..065a83263c8 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -890,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'): diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 2a137aa6235..be095e2dd04 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1211,7 +1211,7 @@ - +