odoo_dev 开发培训作业:图书管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
782B

  1. from xmlrpc import client
  2. server_url = 'http://localhost:9999'
  3. db_name = 'library_13'
  4. username = 'admin'
  5. password = 'admin162534!'
  6. common = client.ServerProxy('%s/xmlrpc/2/common' % server_url)
  7. user_id = common.authenticate(db_name, username, password, {})
  8. models = client.ServerProxy('%s/xmlrpc/2/object' % server_url)
  9. if user_id:
  10. search_domain = ['|', ['name', 'ilike', '大圣归来'], ['name', 'ilike', 'sql']]
  11. books_ids = models.execute_kw(db_name, user_id, password, 'library.book', 'search', [search_domain], {'limit': 5})
  12. print('Books ids found:', books_ids)
  13. books_data = models.execute_kw(db_name, user_id, password, 'library.book', 'read', [books_ids, ['name', 'date_release']])
  14. print("Books data:", books_data)
  15. else:
  16. print('Wrong credentials')
上海开阖软件有限公司 沪ICP备12045867号-1