Update Sale Don Confiao
This commit is contained in:
parent
0663b9ef84
commit
839d76459b
@ -4,3 +4,4 @@ root=/var/lib/trytond/www
|
||||
cors =
|
||||
http://localhost:7000
|
||||
http://localhost:7001
|
||||
http://localhost:3000
|
||||
|
5
Rakefile
5
Rakefile
@ -80,6 +80,11 @@ namespace :live do
|
||||
compose('logs', '-f', 'live.dev', compose: 'compose.yml')
|
||||
end
|
||||
|
||||
desc 'monitorear salida ultimas 50 lineas'
|
||||
task :tail_end do
|
||||
compose('logs', '-f', '-n 50', 'live.dev', compose: 'compose.yml')
|
||||
end
|
||||
|
||||
desc 'detener entorno'
|
||||
task :down do
|
||||
compose('down', compose: 'compose.yml')
|
||||
|
@ -77,9 +77,9 @@ def categories(request, pool):
|
||||
@with_transaction()
|
||||
@don_confiao_application
|
||||
def products(request, pool):
|
||||
Product = pool.get('product.product')
|
||||
with Transaction().set_context(
|
||||
{'company': 1, 'locations': [3]}):
|
||||
Product = pool.get('product.product')
|
||||
products = Product.search_read([
|
||||
('salable', '=', True)
|
||||
], order=[
|
||||
@ -162,7 +162,10 @@ def post_sale(request, pool):
|
||||
request.get_data().decode()
|
||||
)
|
||||
|
||||
Sale.create([dict(data)])
|
||||
sales = Sale.create([dict(data)])
|
||||
|
||||
if sales:
|
||||
return sales[0].id
|
||||
|
||||
|
||||
@app.route('/<database_name>/sale_don_confiao/sales', methods=['GET'])
|
||||
@ -186,3 +189,33 @@ def sales(request, pool):
|
||||
])
|
||||
|
||||
return sales
|
||||
|
||||
|
||||
@app.route('/<database_name>/sale_don_confiao/payment_methods', methods=[
|
||||
'GET'])
|
||||
@allow_null_origin
|
||||
@with_pool
|
||||
@with_transaction()
|
||||
@don_confiao_application
|
||||
def payment_methods(request, pool):
|
||||
if request.method == 'GET':
|
||||
payment_methods = [
|
||||
{
|
||||
"text": "Efectivo",
|
||||
"value": "CASH"
|
||||
},
|
||||
{
|
||||
"text": "Confiar",
|
||||
"value": "CONFIAR"
|
||||
},
|
||||
{
|
||||
"text": "Bancolombia",
|
||||
"value": "BANCOLOMBIA"
|
||||
}
|
||||
]
|
||||
|
||||
response_data = {
|
||||
"payment_methods": payment_methods
|
||||
}
|
||||
|
||||
return response_data, 200
|
||||
|
@ -107,7 +107,7 @@ setup(name=name,
|
||||
],
|
||||
license='GPL-3',
|
||||
python_requires='>=3.8',
|
||||
install_requires=requires,
|
||||
# install_requires=requires,
|
||||
extras_require={
|
||||
'test': tests_require,
|
||||
},
|
||||
|
@ -3,13 +3,21 @@ import requests
|
||||
import json
|
||||
|
||||
url = 'http://localhost:18030'
|
||||
key = '9a9ffc430146447d81e6698240199a4be2b0e774cb18474999d0f60e33b5b1eb1cfff9d9141346a98844879b5a9e787489c891ddc8fb45cc903b7244cab64fb1'
|
||||
key = (
|
||||
'9a9ffc430146447d81'
|
||||
'e6698240199a4be2b0'
|
||||
'e774cb18474999d0f60e'
|
||||
'33b5b1eb1cfff9d91413'
|
||||
'46a98844879b5a9e78748'
|
||||
'9c891ddc8fb45cc903b7244cab64fb1'
|
||||
)
|
||||
|
||||
db = 'tryton'
|
||||
application_name = 'sale_don_confiao'
|
||||
base_url = '{}/{}/{}'.format(url, db, application_name)
|
||||
|
||||
response_parties = requests.get(
|
||||
base_url+'/parties',
|
||||
base_url + '/parties',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
@ -21,7 +29,7 @@ response_party = requests.get(
|
||||
})
|
||||
|
||||
response_post_party = requests.post(
|
||||
base_url+'/parties',
|
||||
base_url + '/parties',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
}, data=json.dumps({
|
||||
@ -29,31 +37,31 @@ response_post_party = requests.post(
|
||||
}))
|
||||
|
||||
response_categories = requests.get(
|
||||
base_url+'/categories',
|
||||
base_url + '/categories',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
|
||||
response_products = requests.get(
|
||||
base_url+'/products',
|
||||
base_url + '/products',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
|
||||
response_search_products = requests.get(
|
||||
base_url+'/search_products/Aceite',
|
||||
base_url + '/search_products/Aceite',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
|
||||
response_sales = requests.get(
|
||||
base_url+'/sales',
|
||||
base_url + '/sales',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
|
||||
response_sale = requests.get(
|
||||
base_url+'/sale/120',
|
||||
base_url + '/sale/120',
|
||||
headers={
|
||||
'Authorization': f'bearer {key}',
|
||||
})
|
||||
|
@ -124,8 +124,10 @@ class DonConfiaoApiRouteTestCase(
|
||||
'Authorization': f'bearer {self.key}',
|
||||
})
|
||||
|
||||
raise Exception(response.text)
|
||||
products = json.loads(
|
||||
response.get_data().decode())
|
||||
response)
|
||||
|
||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
self.assertEqual(len(products), 1)
|
||||
|
||||
@ -236,3 +238,33 @@ class DonConfiaoApiRouteTestCase(
|
||||
# }))
|
||||
|
||||
# self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
#
|
||||
|
||||
def test_get_payment_methods(self):
|
||||
client = self.client()
|
||||
|
||||
response = client.get(
|
||||
f'/{self.db_name}/sale_don_confiao/payment_methods',
|
||||
headers={
|
||||
'Authorization': f'bearer {self.key}',
|
||||
})
|
||||
|
||||
expected_payment_methods = [
|
||||
{
|
||||
"text": "Efectivo",
|
||||
"value": "CASH"
|
||||
},
|
||||
{
|
||||
"text": "Confiar",
|
||||
"value": "CONFIAR"
|
||||
},
|
||||
{
|
||||
"text": "Bancolombia",
|
||||
"value": "BANCOLOMBIA"
|
||||
}
|
||||
]
|
||||
|
||||
self.assertEqual(
|
||||
json.loads(
|
||||
response.text
|
||||
)[0]["payment_methods"], expected_payment_methods)
|
||||
|
@ -5,4 +5,5 @@ depends:
|
||||
party
|
||||
product
|
||||
sale
|
||||
sale_order
|
||||
xml:
|
||||
|
Loading…
Reference in New Issue
Block a user