from trytond.wsgi import app from trytond.protocols.wrappers import ( with_pool, with_transaction, user_application, allow_null_origin) # from werkzeug.wrappers import Response don_confiao_application = user_application( 'sale_don_confiao') @app.route('//sale_don_confiao/parties', methods=[ 'GET']) @app.route('//sale_don_confiao/parties', methods=[ 'POST']) @allow_null_origin @with_pool @with_transaction() @don_confiao_application def parties(request, pool): Party = pool.get('party.party') parties = Party.search_read( [], order=[('id', 'ASC')], fields_names=['id', 'name']) return parties @app.route('//sale_don_confiao/products', methods=['GET']) @allow_null_origin @with_pool @with_transaction() @don_confiao_application def get_products(request, pool): Product = pool.get('product.product') products = Product.search_read( [], order=[('id', 'ASC')], fields_names=['id', 'name']) return products