Raise user error when not sequence configurated

This commit is contained in:
resteve 2013-08-26 17:01:26 +02:00
parent 21d51804bd
commit 1d79033ee9

View file

@ -11,12 +11,22 @@ class Product:
'Product Product'
__name__ = 'product.product'
@classmethod
def __setup__(cls):
super(Product, cls).__setup__()
cls._error_messages.update({
'purchasable_sequence': 'Configure purchasable sequence'
' in Product Configuration',
})
@classmethod
def get_purchase_sequence(cls):
Sequence = Pool().get('ir.sequence')
Configuration = Pool().get('product.configuration')
config = Configuration(1)
if not config.purchasable_sequence:
cls.raise_user_error('purchasable_sequence')
code = Sequence.get_id(config.purchasable_sequence.id)
return code