Compare commits
2 Commits
8411b34f5e
...
4a7c74abb6
Author | SHA1 | Date |
---|---|---|
wilsongomez | 4a7c74abb6 | |
wilsongomez | 8aac4f504a |
|
@ -24,6 +24,8 @@ config.read(config_file)
|
|||
trytond_config = get_config('trytond_config')
|
||||
host_ = config.get('General', 'host')
|
||||
API_KEY = config.get('Auth', 'api_key')
|
||||
API_KEY_VO = config.get('Auth', 'api_key_vo')
|
||||
|
||||
context = {'company': 1, 'user': 1}
|
||||
|
||||
# The actual decorator function
|
||||
|
@ -31,7 +33,10 @@ def require_appkey(view_function):
|
|||
@wraps(view_function)
|
||||
# the new, post-decoration function. Note *args and **kwargs here.
|
||||
def decorated_function(*args, **kwargs):
|
||||
if request.headers.get('Authorization') and request.headers.get('Authorization') == API_KEY:
|
||||
auth = request.headers.get('Authorization')
|
||||
print( 'esta llego mano ... ', auth)
|
||||
print( 'esta clave ... ', API_KEY, ' : ', API_KEY_VO)
|
||||
if auth and auth in [API_KEY, API_KEY_VO]:
|
||||
return view_function(*args, **kwargs)
|
||||
else:
|
||||
abort(401)
|
||||
|
@ -266,13 +271,13 @@ def create_app(dbname):
|
|||
prices2product = {p['template']: p['list_price'] for p in prices}
|
||||
|
||||
for val in values:
|
||||
template = val.template
|
||||
if val.components_used:
|
||||
list_price = sum(k.product.list_price * Decimal(k.quantity) for k in val.components_used)
|
||||
sale_price_w_tax = sum(k.product.template.sale_price_w_tax * Decimal(k.quantity) for k in val.components_used)
|
||||
else:
|
||||
list_price = float(round(prices2product[template.id], 2))
|
||||
sale_price_w_tax = float(round(template.sale_price_w_tax, 2))
|
||||
template = val.template
|
||||
product = {
|
||||
'id': val.id,
|
||||
'name': template.name,
|
||||
|
|
|
@ -271,11 +271,11 @@ def create_app(dbname):
|
|||
prices2product = {p['template']: p['list_price'] for p in prices}
|
||||
|
||||
for val in values:
|
||||
template = val.template
|
||||
if val.components_used:
|
||||
list_price = sum(k.product.list_price * Decimal(k.quantity) for k in val.components_used)
|
||||
else:
|
||||
list_price = float(round(prices2product[template.id], 2))
|
||||
template = val.template
|
||||
product = {
|
||||
'id': val.id,
|
||||
'name': template.name,
|
||||
|
|
Loading…
Reference in New Issue