mirror of
https://github.com/NaN-tic/trytond-product_purchase_sequence.git
synced 2023-12-14 04:02:54 +01:00
Raise user error when not sequence configurated
This commit is contained in:
parent
21d51804bd
commit
1d79033ee9
1 changed files with 10 additions and 0 deletions
10
product.py
10
product.py
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue