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
This commit is contained in:
Cédric Krier
2017-04-01 10:41:38 +02:00
parent e9f5d36328
commit 5eb5afe45f
+5 -2
View File
@@ -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):