Advertisement
Guest User

Untitled

a guest
Feb 12th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. @app.route('/<database_name>/products', methods=['GET'])
  2. @with_pool
  3. @with_transaction()
  4. def products(request, pool):
  5.     Product = pool.get('product.product')
  6.     products = Product.search([
  7.             ('active', '=', True),
  8.             ])
  9.     return [{
  10.             'code': p.code,
  11.             'name': p.template.name
  12.             } for p in products]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement