Update Sale Don Confiao
This commit is contained in:
parent
0663b9ef84
commit
839d76459b
@ -4,3 +4,4 @@ root=/var/lib/trytond/www
|
|||||||
cors =
|
cors =
|
||||||
http://localhost:7000
|
http://localhost:7000
|
||||||
http://localhost:7001
|
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')
|
compose('logs', '-f', 'live.dev', compose: 'compose.yml')
|
||||||
end
|
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'
|
desc 'detener entorno'
|
||||||
task :down do
|
task :down do
|
||||||
compose('down', compose: 'compose.yml')
|
compose('down', compose: 'compose.yml')
|
||||||
|
@ -77,9 +77,9 @@ def categories(request, pool):
|
|||||||
@with_transaction()
|
@with_transaction()
|
||||||
@don_confiao_application
|
@don_confiao_application
|
||||||
def products(request, pool):
|
def products(request, pool):
|
||||||
Product = pool.get('product.product')
|
|
||||||
with Transaction().set_context(
|
with Transaction().set_context(
|
||||||
{'company': 1, 'locations': [3]}):
|
{'company': 1, 'locations': [3]}):
|
||||||
|
Product = pool.get('product.product')
|
||||||
products = Product.search_read([
|
products = Product.search_read([
|
||||||
('salable', '=', True)
|
('salable', '=', True)
|
||||||
], order=[
|
], order=[
|
||||||
@ -162,7 +162,10 @@ def post_sale(request, pool):
|
|||||||
request.get_data().decode()
|
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'])
|
@app.route('/<database_name>/sale_don_confiao/sales', methods=['GET'])
|
||||||
@ -186,3 +189,33 @@ def sales(request, pool):
|
|||||||
])
|
])
|
||||||
|
|
||||||
return sales
|
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',
|
license='GPL-3',
|
||||||
python_requires='>=3.8',
|
python_requires='>=3.8',
|
||||||
install_requires=requires,
|
# install_requires=requires,
|
||||||
extras_require={
|
extras_require={
|
||||||
'test': tests_require,
|
'test': tests_require,
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,15 @@ import requests
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
url = 'http://localhost:18030'
|
url = 'http://localhost:18030'
|
||||||
key = '9a9ffc430146447d81e6698240199a4be2b0e774cb18474999d0f60e33b5b1eb1cfff9d9141346a98844879b5a9e787489c891ddc8fb45cc903b7244cab64fb1'
|
key = (
|
||||||
|
'9a9ffc430146447d81'
|
||||||
|
'e6698240199a4be2b0'
|
||||||
|
'e774cb18474999d0f60e'
|
||||||
|
'33b5b1eb1cfff9d91413'
|
||||||
|
'46a98844879b5a9e78748'
|
||||||
|
'9c891ddc8fb45cc903b7244cab64fb1'
|
||||||
|
)
|
||||||
|
|
||||||
db = 'tryton'
|
db = 'tryton'
|
||||||
application_name = 'sale_don_confiao'
|
application_name = 'sale_don_confiao'
|
||||||
base_url = '{}/{}/{}'.format(url, db, application_name)
|
base_url = '{}/{}/{}'.format(url, db, application_name)
|
||||||
|
@ -124,8 +124,10 @@ class DonConfiaoApiRouteTestCase(
|
|||||||
'Authorization': f'bearer {self.key}',
|
'Authorization': f'bearer {self.key}',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
raise Exception(response.text)
|
||||||
products = json.loads(
|
products = json.loads(
|
||||||
response.get_data().decode())
|
response)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||||
self.assertEqual(len(products), 1)
|
self.assertEqual(len(products), 1)
|
||||||
|
|
||||||
@ -236,3 +238,33 @@ class DonConfiaoApiRouteTestCase(
|
|||||||
# }))
|
# }))
|
||||||
|
|
||||||
# self.assertEqual(response.status_code, HTTPStatus.OK)
|
# 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
|
party
|
||||||
product
|
product
|
||||||
sale
|
sale
|
||||||
|
sale_order
|
||||||
xml:
|
xml:
|
||||||
|
Loading…
Reference in New Issue
Block a user