From 162c3e320db78f7d2e7b38fbaa36d565ed111b8a Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 1 Dec 2009 12:23:16 +0530 Subject: [PATCH] [FIX] Stock/MRP : Track line wizard improved lp bug: https://launchpad.net/bugs/488869 fixed bzr revid: jvo@tinyerp.com-20091201065316-k1tgyj1vn5mr2hbi --- addons/mrp/wizard/wizard_track_line.py | 9 ++++++++- addons/stock/wizard/wizard_track_line.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/mrp/wizard/wizard_track_line.py b/addons/mrp/wizard/wizard_track_line.py index 26236c55e13..0866212549a 100644 --- a/addons/mrp/wizard/wizard_track_line.py +++ b/addons/mrp/wizard/wizard_track_line.py @@ -48,6 +48,13 @@ fields = { } } +def _check_picking(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + move_obj = pool.get('stock.move').browse(cr, uid, data['id']) + if not move_obj.picking_id: + raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.')) + return data['form'] + def _track_lines(self, cr, uid, data, context): move_id = data['id'] @@ -115,7 +122,7 @@ def _track_lines(self, cr, uid, data, context): class wizard_track_move(wizard.interface): states = { 'init': { - 'actions': [], + 'actions': [_check_picking], 'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]}, }, 'track': { diff --git a/addons/stock/wizard/wizard_track_line.py b/addons/stock/wizard/wizard_track_line.py index 79c105b962b..9576a9cb2f0 100644 --- a/addons/stock/wizard/wizard_track_line.py +++ b/addons/stock/wizard/wizard_track_line.py @@ -48,6 +48,13 @@ fields = { } } +def _check_picking(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + move_obj = pool.get('stock.move').browse(cr, uid, data['id']) + if not move_obj.picking_id: + raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.')) + return data['form'] + def _track_lines(self, cr, uid, data, context): move_id = data['id'] @@ -116,7 +123,7 @@ def _track_lines(self, cr, uid, data, context): class wizard_track_move(wizard.interface): states = { 'init': { - 'actions': [], + 'actions': [_check_picking], 'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]}, }, 'track': {