Skip to content

Commit

Permalink
Catch value error in case view isn't yet loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
llacroix committed Apr 22, 2015
1 parent f95a895 commit fda31b9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions quantity_warn_on_lot/models/stock_move_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging

from openerp.osv import orm
from openerp.tools.translate import _

_logger = logging.getLogger(__name__)


class InvalidAmountException(Exception):

Expand Down Expand Up @@ -55,9 +58,15 @@ class StockMoveSplit(orm.TransientModel):
def get_confirm_view_id(self, cr, uid, context=None):
"""Get the default view id for the confirm view."""
ir_model_data = self.pool.get('ir.model.data')
view_ref = ir_model_data.get_object_reference(
cr, uid, 'quantity_warn_on_lot', 'view_confirm_split'
)

try:
view_ref = ir_model_data.get_object_reference(
cr, uid, 'quantity_warn_on_lot', 'view_confirm_split'
)
except ValueError as exc:
_logger.debug(exc)
view_ref = None

return view_ref and view_ref[1] or False

def restore_split(self, cr, uid, ids, context=None):
Expand Down

0 comments on commit fda31b9

Please sign in to comment.