From 5eb5afe45f92e1b4fcce609827ada535310e6469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Apr 2017 10:41:38 +0200 Subject: [PATCH] Catch KeyError on ModelData.get_id in default method Since changeset 685f2d888dca, the default methods are always called in __register__ when the XML files are not yet loaded. issue6409 --- account.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/account.py b/account.py index a7d73f1a86..ffa30f0574 100644 --- a/account.py +++ b/account.py @@ -66,8 +66,11 @@ class ConfigurationLandedCostSequence(ModelSQL, CompanyValueMixin): def default_landed_cost_sequence(cls): pool = Pool() ModelData = pool.get('ir.model.data') - return ModelData.get_id( - 'account_stock_landed_cost', 'sequence_landed_cost') + try: + return ModelData.get_id( + 'account_stock_landed_cost', 'sequence_landed_cost') + except KeyError: + return None class LandedCost(Workflow, ModelSQL, ModelView):