26 lines
575 B
Python
26 lines
575 B
Python
from trytond.wsgi import app
|
|
from trytond.protocols.wrappers import (
|
|
with_pool,
|
|
with_transaction,
|
|
user_application,
|
|
allow_null_origin)
|
|
import json
|
|
|
|
sale_order = user_application('sale_order')
|
|
|
|
|
|
@app.route('/<database_name>/sale_order/order', methods=['POST'])
|
|
@allow_null_origin
|
|
@with_pool
|
|
@with_transaction()
|
|
@sale_order
|
|
def order(request, pool):
|
|
raise Exception(request)
|
|
Order = pool.get('sale.order')
|
|
if request.method == 'POST':
|
|
data = json.loads(
|
|
request.get_data().decode()
|
|
)
|
|
|
|
Order.create([dict(data)])
|